Class: Leftovers::Processors::AddPrefix

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

Instance Method Summary collapse

Methods included from ComparableInstance

#eql?, #hash

Constructor Details

#initialize(prefix, then_processor) ⇒ AddPrefix

Returns a new instance of AddPrefix.



8
9
10
11
12
13
# File 'lib/leftovers/processors/add_prefix.rb', line 8

def initialize(prefix, then_processor)
  @prefix = prefix
  @then_processor = then_processor

  freeze
end

Instance Method Details

#process(str, current_node, matched_node, acc) ⇒ Object



15
16
17
18
19
# File 'lib/leftovers/processors/add_prefix.rb', line 15

def process(str, current_node, matched_node, acc)
  return unless str

  @then_processor.process("#{@prefix}#{str}", current_node, matched_node, acc)
end