Class: Leftovers::Processors::MatchMatchedNode

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ComparableInstance

#eql?, #hash

Constructor Details

#initialize(matcher, then_processor) ⇒ MatchMatchedNode

Returns a new instance of MatchMatchedNode.



10
11
12
13
14
15
# File 'lib/leftovers/processors/match_matched_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_matched_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_matched_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_matched_node.rb', line 17

def process(str, current_node, matched_node, acc)
  return unless @matcher === matched_node

  @then_processor.process(str, current_node, matched_node, acc)
end