Module: JRuby::Lint::AST::Helpers
- Included in:
- Checkers::Gemspec
- Defined in:
- lib/jruby/lint/ast.rb
Instance Method Summary collapse
Instance Method Details
#descendants(node) ⇒ Object
26 27 28 29 |
# File 'lib/jruby/lint/ast.rb', line 26 def descendants(node) children = node.child_nodes children.empty? ? [node] : children.map {|n| [n] + descendants(n) }.flatten end |
#find_first(node, &block) ⇒ Object
22 23 24 |
# File 'lib/jruby/lint/ast.rb', line 22 def find_first(node, &block) descendants(node).detect(&block) end |