Skip to content
This repository
Browse code

adding select core

  • Loading branch information...
commit 61e0280b5d5cd36a5340ba8478d0bc1c9c5fea41 1 parent 20cd623
Aaron Patterson tenderlove authored
9 lib/arel/visitors/depth_first.rb
@@ -61,6 +61,15 @@ def terminal o
61 61 alias :visit_Time :terminal
62 62 alias :visit_TrueClass :terminal
63 63
  64 + def visit_Arel_Nodes_SelectCore o
  65 + visit o.projections
  66 + visit o.froms
  67 + visit o.wheres
  68 + visit o.groups
  69 + visit o.having
  70 + @block.call o
  71 + end
  72 +
64 73 def visit_Arel_Nodes_UpdateStatement o
65 74 visit o.relation
66 75 visit o.values
18 test/visitors/test_depth_first.rb
@@ -84,6 +84,24 @@ def test_update_statement
84 84 assert_equal [:a, :b, stmt.values, :c, stmt.wheres, :d, stmt.orders,
85 85 :e, stmt], @collector.calls
86 86 end
  87 +
  88 + def test_select_core
  89 + core = Nodes::SelectCore.new
  90 + core.projections << :a
  91 + core.froms = :b
  92 + core.wheres << :c
  93 + core.groups << :d
  94 + core.having = :e
  95 +
  96 + @visitor.accept core
  97 + assert_equal [
  98 + :a, core.projections,
  99 + :b,
  100 + :c, core.wheres,
  101 + :d, core.groups,
  102 + :e,
  103 + core], @collector.calls
  104 + end
87 105 end
88 106 end
89 107 end

0 comments on commit 61e0280

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