Skip to content

Commit

Permalink
adding select core
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Nov 29, 2010
1 parent 20cd623 commit 61e0280
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/arel/visitors/depth_first.rb
Expand Up @@ -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
Expand Down
18 changes: 18 additions & 0 deletions test/visitors/test_depth_first.rb
Expand Up @@ -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.