Class: Leftovers::Processors::DeleteSuffix

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

Instance Method Summary collapse

Methods included from ComparableInstance

#eql?, #hash

Constructor Details

#initialize(suffix, then_processor) ⇒ DeleteSuffix

Returns a new instance of DeleteSuffix.



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

def initialize(suffix, then_processor)
  @suffix = suffix
  @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/delete_suffix.rb', line 15

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

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