Class: Deadlyzer::AST::Matcher

Inherits:
Object
  • Object
show all
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.

Since:

  • 0.1.0

'(const ... )'

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#matcherObject (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.

Since:

  • 0.1.0



10
11
12
# File 'lib/deadlyzer/ast_matcher.rb', line 10

def matcher
  @matcher
end

#patternObject (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.

Since:

  • 0.1.0



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.

Since:

  • 0.1.0



23
24
25
# File 'lib/deadlyzer/ast_matcher.rb', line 23

def match(node:)
  matcher.new(pattern).match(node)
end