diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/arel/nodes/node.rb | 2 | ||||
-rw-r--r-- | lib/arel/visitors/depth_first.rb | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/lib/arel/nodes/node.rb b/lib/arel/nodes/node.rb index 90c63f0be9..634e580a8f 100644 --- a/lib/arel/nodes/node.rb +++ b/lib/arel/nodes/node.rb @@ -37,6 +37,8 @@ module Arel # Iterate through AST, nodes will be yielded depth-first def each &block + return enum_for(:each) unless block_given? + Visitors::DepthFirst.new(block).accept self end end diff --git a/lib/arel/visitors/depth_first.rb b/lib/arel/visitors/depth_first.rb index 46171dc5bd..00f18727f0 100644 --- a/lib/arel/visitors/depth_first.rb +++ b/lib/arel/visitors/depth_first.rb @@ -93,6 +93,7 @@ module Arel alias :visit_ActiveSupport_Multibyte_Chars :terminal alias :visit_ActiveSupport_StringInquirer :terminal alias :visit_Arel_Nodes_Lock :terminal + alias :visit_Arel_Nodes_Node :terminal alias :visit_Arel_Nodes_SqlLiteral :terminal alias :visit_Arel_SqlLiteral :terminal alias :visit_BigDecimal :terminal |