Class: Machete::Matchers::LiteralMatcher
- Defined in:
- lib/machete/matchers.rb
Instance Attribute Summary collapse
-
#literal ⇒ Object
readonly
Returns the value of attribute literal.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(literal) ⇒ LiteralMatcher
constructor
A new instance of LiteralMatcher.
- #matches?(node) ⇒ Boolean
Constructor Details
#initialize(literal) ⇒ LiteralMatcher
Returns a new instance of LiteralMatcher.
123 124 125 |
# File 'lib/machete/matchers.rb', line 123 def initialize(literal) @literal = literal end |
Instance Attribute Details
#literal ⇒ Object (readonly)
Returns the value of attribute literal.
121 122 123 |
# File 'lib/machete/matchers.rb', line 121 def literal @literal end |
Instance Method Details
#==(other) ⇒ Object
127 128 129 |
# File 'lib/machete/matchers.rb', line 127 def ==(other) other.instance_of?(self.class) && @literal == other.literal end |
#matches?(node) ⇒ Boolean
131 132 133 |
# File 'lib/machete/matchers.rb', line 131 def matches?(node) @literal == node end |