Class: Evilution::AST::Pattern::NodeMatcher Private
- Inherits:
-
Object
- Object
- Evilution::AST::Pattern::NodeMatcher
- Defined in:
- lib/evilution/ast/pattern/matcher.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary collapse
- #attributes ⇒ Object readonly private
- #node_type ⇒ Object readonly private
Instance Method Summary collapse
-
#initialize(node_type, attributes) ⇒ NodeMatcher
constructor
private
A new instance of NodeMatcher.
- #match?(node) ⇒ Boolean private
Constructor Details
#initialize(node_type, attributes) ⇒ NodeMatcher
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of NodeMatcher.
9 10 11 12 13 |
# File 'lib/evilution/ast/pattern/matcher.rb', line 9 def initialize(node_type, attributes) @node_type = node_type @prism_class = resolve_prism_class(node_type) @attributes = attributes end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
7 8 9 |
# File 'lib/evilution/ast/pattern/matcher.rb', line 7 def attributes @attributes end |
#node_type ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
7 8 9 |
# File 'lib/evilution/ast/pattern/matcher.rb', line 7 def node_type @node_type end |
Instance Method Details
#match?(node) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
15 16 17 18 19 |
# File 'lib/evilution/ast/pattern/matcher.rb', line 15 def match?(node) return false unless node.is_a?(@prism_class) @attributes.all? { |attr_name, value_matcher| match_attribute?(node, attr_name, value_matcher) } end |