Method: RuboCop::Cop::Util.on_node
- Defined in:
- lib/rubocop/cop/util.rb
permalink .on_node(syms, sexp, excludes = []) {|sexp| ... } ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/rubocop/cop/util.rb', line 78 def on_node(syms, sexp, excludes = [], &block) return to_enum(:on_node, syms, sexp, excludes) unless block_given? yield sexp if Array(syms).include?(sexp.type) return if Array(excludes).include?(sexp.type) sexp.children.each do |elem| next unless elem.is_a?(Parser::AST::Node) on_node(syms, elem, excludes, &block) end end |