Class: Leftovers::Processors::Deconstantize

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

Instance Method Summary collapse

Methods included from ComparableInstance

#eql?, #hash

Constructor Details

#initialize(then_processor) ⇒ Deconstantize

Returns a new instance of Deconstantize.



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

def initialize(then_processor)
  @then_processor = then_processor

  freeze
end

Instance Method Details

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



14
15
16
17
18
19
20
21
22
23
# File 'lib/leftovers/processors/deconstantize.rb', line 14

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

  @then_processor.process(str.deconstantize, current_node, matched_node, acc)
rescue ::NoMethodError
  ::Leftovers.error <<~MESSAGE
    Tried using the ::String#deconstantize method, but the activesupport gem was not available and/or not required
    `gem install activesupport`, and/or add `requires: ['active_support', 'active_support/core_ext/string']` to your .leftovers.yml
  MESSAGE
end