Method: Sexp#grep_node
- Defined in:
- lib/code_analyzer/sexp.rb
#grep_node(options) ⇒ Object
grep all the recursive child nodes with conditions, and yield the first match node.
options is the grep conditions, like
sexp_type: :call,
receiver: s(:const, Post),
message: [:find, :new]
the condition key is one of :sexp_type, :receiver, :message, and to_s, the condition value can be Symbol, Array or Sexp.
101 102 103 104 105 106 107 108 |
# File 'lib/code_analyzer/sexp.rb', line 101 def grep_node() result = CodeAnalyzer::Nil.new grep_nodes() do |node| result = node break end result end |