2017-02-13 13:58:58 -05:00
|
|
|
# frozen_string_literal: true
|
2018-02-24 01:45:50 -05:00
|
|
|
|
2010-08-16 20:44:48 -04:00
|
|
|
module Arel
|
|
|
|
module Compatibility # :nodoc:
|
|
|
|
class Wheres # :nodoc:
|
|
|
|
include Enumerable
|
|
|
|
|
|
|
|
module Value # :nodoc:
|
|
|
|
attr_accessor :visitor
|
|
|
|
def value
|
|
|
|
visitor.accept self
|
|
|
|
end
|
2010-09-10 19:58:19 -04:00
|
|
|
|
|
|
|
def name
|
|
|
|
super.to_sym
|
|
|
|
end
|
2010-08-16 20:44:48 -04:00
|
|
|
end
|
|
|
|
|
2018-02-24 01:45:50 -05:00
|
|
|
def initialize(engine, collection)
|
2010-08-16 20:44:48 -04:00
|
|
|
@engine = engine
|
|
|
|
@collection = collection
|
|
|
|
end
|
|
|
|
|
|
|
|
def each
|
|
|
|
to_sql = Visitors::ToSql.new @engine
|
|
|
|
|
|
|
|
@collection.each { |c|
|
|
|
|
c.extend(Value)
|
|
|
|
c.visitor = to_sql
|
|
|
|
yield c
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|