Class: Transpec::AST::Node
- Inherits:
-
Parser::AST::Node
- Object
- Parser::AST::Node
- Transpec::AST::Node
- Defined in:
- lib/transpec/ast/node.rb
Instance Method Summary collapse
- #child_nodes ⇒ Object
- #descendent_nodes ⇒ Object
- #each_child_node ⇒ Object
- #each_descendent_node(&block) ⇒ Object
Instance Method Details
#child_nodes ⇒ Object
19 20 21 |
# File 'lib/transpec/ast/node.rb', line 19 def child_nodes each_child_node.to_a end |
#descendent_nodes ⇒ Object
32 33 34 |
# File 'lib/transpec/ast/node.rb', line 32 def descendent_nodes each_descendent_node.to_a end |
#each_child_node ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/transpec/ast/node.rb', line 8 def each_child_node return to_enum(__method__) unless block_given? children.each do |child| next unless child.is_a?(self.class) yield child end self end |
#each_descendent_node(&block) ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/transpec/ast/node.rb', line 23 def each_descendent_node(&block) return to_enum(__method__) unless block_given? each_child_node do |child_node| yield child_node child_node.each_child_node(&block) end end |