Class: Leftovers::Matchers::NodeScalarValue
- Inherits:
-
Object
- Object
- Leftovers::Matchers::NodeScalarValue
- Includes:
- ComparableInstance
- Defined in:
- lib/leftovers/matchers/node_scalar_value.rb
Instance Attribute Summary collapse
-
#matcher ⇒ Object
readonly
Returns the value of attribute matcher.
Instance Method Summary collapse
- #===(node) ⇒ Object
-
#initialize(matcher) ⇒ NodeScalarValue
constructor
A new instance of NodeScalarValue.
Methods included from ComparableInstance
Constructor Details
#initialize(matcher) ⇒ NodeScalarValue
Returns a new instance of NodeScalarValue.
10 11 12 13 14 |
# File 'lib/leftovers/matchers/node_scalar_value.rb', line 10 def initialize(matcher) @matcher = matcher freeze end |
Instance Attribute Details
#matcher ⇒ Object (readonly)
Returns the value of attribute matcher.
8 9 10 |
# File 'lib/leftovers/matchers/node_scalar_value.rb', line 8 def matcher @matcher end |
Instance Method Details
#===(node) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/leftovers/matchers/node_scalar_value.rb', line 16 def ===(node) # can't just check to_scalar_value, it might be false/nil on purpose. return unless node.scalar? @matcher === node.to_scalar_value end |