Class: Leftovers::Processors::MatchCurrentNode

Inherits:
Object
  • Object
show all
Includes:
ComparableInstance
Defined in:
lib/leftovers/processors/match_current_node.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ComparableInstance

#eql?, #hash

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

#matcherObject (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_processorObject (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