aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/arel/compatibility/wheres.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/arel/compatibility/wheres.rb')
-rw-r--r--activerecord/lib/arel/compatibility/wheres.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/activerecord/lib/arel/compatibility/wheres.rb b/activerecord/lib/arel/compatibility/wheres.rb
new file mode 100644
index 0000000000..3e60894bd8
--- /dev/null
+++ b/activerecord/lib/arel/compatibility/wheres.rb
@@ -0,0 +1,34 @@
+# frozen_string_literal: true
+module Arel
+ module Compatibility # :nodoc:
+ class Wheres # :nodoc:
+ include Enumerable
+
+ module Value # :nodoc:
+ attr_accessor :visitor
+ def value
+ visitor.accept self
+ end
+
+ def name
+ super.to_sym
+ end
+ end
+
+ def initialize engine, collection
+ @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