Class: Leftovers::Processors::MatchCurrentNode
- Inherits:
-
Object
- Object
- Leftovers::Processors::MatchCurrentNode
- Includes:
- ComparableInstance
- Defined in:
- lib/leftovers/processors/match_current_node.rb
Instance Attribute Summary collapse
-
#matcher ⇒ Object
readonly
Returns the value of attribute matcher.
-
#then_processor ⇒ Object
readonly
Returns the value of attribute then_processor.
Instance Method Summary collapse
-
#initialize(matcher, then_processor) ⇒ MatchCurrentNode
constructor
A new instance of MatchCurrentNode.
- #process(str, current_node, matched_node, acc) ⇒ Object
Methods included from ComparableInstance
Constructor Details
#initialize(matcher, then_processor) ⇒ MatchCurrentNode
Returns a new instance of MatchCurrentNode.
10 11 12 13 14 15 |
# File 'lib/leftovers/processors/match_current_node.rb', line 10 def initialize(matcher, then_processor) @matcher = matcher @then_processor = then_processor freeze end |
Instance Attribute Details
#matcher ⇒ Object (readonly)
Returns the value of attribute matcher.
8 9 10 |
# File 'lib/leftovers/processors/match_current_node.rb', line 8 def matcher @matcher end |
#then_processor ⇒ Object (readonly)
Returns the value of attribute then_processor.
8 9 10 |
# File 'lib/leftovers/processors/match_current_node.rb', line 8 def then_processor @then_processor end |
Instance Method Details
#process(str, current_node, matched_node, acc) ⇒ Object
17 18 19 20 21 |
# File 'lib/leftovers/processors/match_current_node.rb', line 17 def process(str, current_node, matched_node, acc) return unless @matcher === current_node @then_processor.process(str, current_node, matched_node, acc) end |