Class: Evilution::AST::Pattern::ValueMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/evilution/ast/pattern/matcher.rb

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ ValueMatcher

Returns a new instance of ValueMatcher.



56
57
58
# File 'lib/evilution/ast/pattern/matcher.rb', line 56

def initialize(value)
  @value = value
end

Instance Method Details

#match?(node) ⇒ Boolean

Returns:

  • (Boolean)


64
65
66
# File 'lib/evilution/ast/pattern/matcher.rb', line 64

def match?(node)
  match_value?(node)
end

#match_value?(actual) ⇒ Boolean

Returns:

  • (Boolean)


60
61
62
# File 'lib/evilution/ast/pattern/matcher.rb', line 60

def match_value?(actual)
  actual.to_s == @value
end