Skip to content
Browse files

adding select core

  • Loading branch information...
1 parent 20cd623 commit 61e0280b5d5cd36a5340ba8478d0bc1c9c5fea41 @tenderlove tenderlove committed Nov 29, 2010
Showing with 27 additions and 0 deletions.
  1. +9 −0 lib/arel/visitors/depth_first.rb
  2. +18 −0 test/visitors/test_depth_first.rb
View
9 lib/arel/visitors/depth_first.rb
@@ -61,6 +61,15 @@ def terminal o
alias :visit_Time :terminal
alias :visit_TrueClass :terminal
+ def visit_Arel_Nodes_SelectCore o
+ visit o.projections
+ visit o.froms
+ visit o.wheres
+ visit o.groups
+ visit o.having
+ @block.call o
+ end
+
def visit_Arel_Nodes_UpdateStatement o
visit o.relation
visit o.values
View
18 test/visitors/test_depth_first.rb
@@ -84,6 +84,24 @@ def test_update_statement
assert_equal [:a, :b, stmt.values, :c, stmt.wheres, :d, stmt.orders,
:e, stmt], @collector.calls
end
+
+ def test_select_core
+ core = Nodes::SelectCore.new
+ core.projections << :a
+ core.froms = :b
+ core.wheres << :c
+ core.groups << :d
+ core.having = :e
+
+ @visitor.accept core
+ assert_equal [
+ :a, core.projections,
+ :b,
+ :c, core.wheres,
+ :d, core.groups,
+ :e,
+ core], @collector.calls
+ end
end
end
end

0 comments on commit 61e0280

Please sign in to comment.
Something went wrong with that request. Please try again.