Class: Deadlyzer::AST::Matcher
- Inherits:
-
Object
- Object
- Deadlyzer::AST::Matcher
- Defined in:
- lib/deadlyzer/ast_matcher.rb
Constant Summary collapse
- DEFAULT_PATTERN =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'(const ... )'
Instance Attribute Summary collapse
- #matcher ⇒ Object readonly private
- #pattern ⇒ Object readonly private
Instance Method Summary collapse
-
#initialize(matcher: nil, pattern: nil) ⇒ Matcher
constructor
A new instance of Matcher.
- #match(node:) ⇒ Object private
Constructor Details
#initialize(matcher: nil, pattern: nil) ⇒ Matcher
16 17 18 19 |
# File 'lib/deadlyzer/ast_matcher.rb', line 16 def initialize(matcher: nil, pattern: nil) @matcher = matcher || default_matcher @pattern = pattern || DEFAULT_PATTERN end |
Instance Attribute Details
#matcher ⇒ 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.
10 11 12 |
# File 'lib/deadlyzer/ast_matcher.rb', line 10 def matcher @matcher end |
#pattern ⇒ 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.
14 15 16 |
# File 'lib/deadlyzer/ast_matcher.rb', line 14 def pattern @pattern end |
Instance Method Details
#match(node:) ⇒ Object
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.
23 24 25 |
# File 'lib/deadlyzer/ast_matcher.rb', line 23 def match(node:) matcher.new(pattern).match(node) end |