lib/attr_searchable/arel/visitors.rb in attr_searchable-0.0.1 vs lib/attr_searchable/arel/visitors.rb in attr_searchable-0.0.2
- old
+ new
@@ -3,22 +3,86 @@
module Arel
module Visitors
module ToSql
if ::Arel::VERSION >= "4.0.1"
def visit_AttrSearchableGrammar_Nodes_And(o, a)
- visit ::Arel::Nodes::Grouping.new(o.to_arel), a
+ visit ::Arel::Nodes::Grouping.new(o.nodes.inject { |res, cur| ::Arel::Nodes::And.new [res, cur] }), a
end
def visit_AttrSearchableGrammar_Nodes_Or(o, a)
- visit ::Arel::Nodes::Grouping.new(o.to_arel), a
+ visit ::Arel::Nodes::Grouping.new(o.nodes.inject { |res, cur| ::Arel::Nodes::Or.new res, cur }), a
end
+
+ def visit_AttrSearchableGrammar_Nodes_Equality(o, a)
+ visit ::Arel::Nodes::Equality.new(o.left, o.right), a
+ end
+
+ def visit_AttrSearchableGrammar_Nodes_NotEqual(o, a)
+ visit ::Arel::Nodes::NotEqual.new(o.left, o.right), a
+ end
+
+ def visit_AttrSearchableGrammar_Nodes_LessThan(o, a)
+ visit ::Arel::Nodes::LessThan.new(o.left, o.right), a
+ end
+
+ def visit_AttrSearchableGrammar_Nodes_LessThanOrEqual(o, a)
+ visit ::Arel::Nodes::LessThanOrEqual.new(o.left, o.right), a
+ end
+
+ def visit_AttrSearchableGrammar_Nodes_GreaterThan(o, a)
+ visit ::Arel::Nodes::GreaterThan.new(o.left, o.right), a
+ end
+
+ def visit_AttrSearchableGrammar_Nodes_GreaterThanOrEqual(o, a)
+ visit ::Arel::Nodes::GreaterThanOrEqual.new(o.left, o.right), a
+ end
+
+ def visit_AttrSearchableGrammar_Nodes_Not(o, a)
+ visit ::Arel::Nodes::Not.new(o.object), a
+ end
+
+ def visit_AttrSearchableGrammar_Nodes_Matches(o, a)
+ visit ::Arel::Nodes::Matches.new(o.left, o.right), a
+ end
else
def visit_AttrSearchableGrammar_Nodes_And(o)
- visit ::Arel::Nodes::Grouping.new(o.to_arel)
+ visit ::Arel::Nodes::Grouping.new(o.nodes.inject { |res, cur| ::Arel::Nodes::And.new [res, cur] })
end
def visit_AttrSearchableGrammar_Nodes_Or(o)
- visit ::Arel::Nodes::Grouping.new(o.to_arel)
+ visit ::Arel::Nodes::Grouping.new(o.nodes.inject { |res, cur| ::Arel::Nodes::Or.new res, cur })
+ end
+
+ def visit_AttrSearchableGrammar_Nodes_Equality(o)
+ visit ::Arel::Nodes::Equality.new(o.left, o.right)
+ end
+
+ def visit_AttrSearchableGrammar_Nodes_NotEqual(o)
+ visit ::Arel::Nodes::NotEqual.new(o.left, o.right)
+ end
+
+ def visit_AttrSearchableGrammar_Nodes_LessThan(o)
+ visit ::Arel::Nodes::LessThan.new(o.left, o.right)
+ end
+
+ def visit_AttrSearchableGrammar_Nodes_LessThanOrEqual(o)
+ visit ::Arel::Nodes::LessThanOrEqual.new(o.left, o.right)
+ end
+
+ def visit_AttrSearchableGrammar_Nodes_GreaterThan(o)
+ visit ::Arel::Nodes::GreaterThan.new(o.left, o.right)
+ end
+
+ def visit_AttrSearchableGrammar_Nodes_GreaterThanOrEqual(o)
+ visit ::Arel::Nodes::GreaterThanOrEqual.new(o.left, o.right)
+ end
+
+ def visit_AttrSearchableGrammar_Nodes_Not(o)
+ visit ::Arel::Nodes::Not.new(o.object)
+ end
+
+ def visit_AttrSearchableGrammar_Nodes_Matches(o)
+ visit ::Arel::Nodes::Matches.new(o.left, o.right)
end
end
end
module MySQL