Sha256: 3bb98d30a0298f95b704a92b24d0203b5ef8eb817fe7e321399c135b5c622ed4

Contents?: true

Size: 704 Bytes

Versions: 6

Compression:

Stored size: 704 Bytes

Contents

# frozen_string_literal: true

module Leftovers
  module ValueProcessors
    class Deconstantize
      def initialize(then_processor)
        @then_processor = then_processor

        freeze
      end

      def process(str, node, method_node)
        return unless str

        @then_processor.process(str.deconstantize, node, method_node)
      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
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
leftovers-0.8.0 lib/leftovers/value_processors/deconstantize.rb
leftovers-0.7.0 lib/leftovers/value_processors/deconstantize.rb
leftovers-0.6.0 lib/leftovers/value_processors/deconstantize.rb
leftovers-0.5.5 lib/leftovers/value_processors/deconstantize.rb
leftovers-0.5.4 lib/leftovers/value_processors/deconstantize.rb
leftovers-0.5.3 lib/leftovers/value_processors/deconstantize.rb