Class: Evilution::AST::Pattern::AlternativesMatcher
- Inherits:
-
Object
- Object
- Evilution::AST::Pattern::AlternativesMatcher
- Defined in:
- lib/evilution/ast/pattern/matcher.rb
Instance Method Summary collapse
-
#initialize(values) ⇒ AlternativesMatcher
constructor
A new instance of AlternativesMatcher.
- #match?(node) ⇒ Boolean
- #match_value?(actual) ⇒ Boolean
Constructor Details
#initialize(values) ⇒ AlternativesMatcher
Returns a new instance of AlternativesMatcher.
70 71 72 |
# File 'lib/evilution/ast/pattern/matcher.rb', line 70 def initialize(values) @values = values end |
Instance Method Details
#match?(node) ⇒ Boolean
79 80 81 |
# File 'lib/evilution/ast/pattern/matcher.rb', line 79 def match?(node) match_value?(node) end |
#match_value?(actual) ⇒ Boolean
74 75 76 77 |
# File 'lib/evilution/ast/pattern/matcher.rb', line 74 def match_value?(actual) actual_str = actual.to_s @values.any? { |v| actual_str == v } end |