Class: Fast::Parent
Overview
Sometimes you want to check some children but get the parent element,
for such cases, parent can be useful.
Example: You're searching for int usages in your code.
But you don't want to check the integer itself, but who is using it:
^^(int _) will give you the variable being assigned or the expression being used.
Instance Attribute Summary
Attributes inherited from Find
Instance Method Summary collapse
Methods inherited from Find
#==, #compare_symbol_or_head, #debug, #debug_match_recursive, #initialize, #match_recursive
Constructor Details
This class inherits a constructor from Fast::Find
Instance Method Details
#match?(node) ⇒ Boolean
778 779 780 |
# File 'lib/fast.rb', line 778 def match?(node) node.each_child_node.any?(&method(:match_node)) end |
#match_node ⇒ Object
777 |
# File 'lib/fast.rb', line 777 alias match_node match? |
#to_s ⇒ Object
782 783 784 |
# File 'lib/fast.rb', line 782 def to_s "^#{token}" end |