Sha256: 3467e3ac27f56e3f0b5a08916adbd51e06587330af1e65f15ea84637328d5bba

Contents?: true

Size: 766 Bytes

Versions: 4

Compression:

Stored size: 766 Bytes

Contents

# frozen_string_literal: true

module Leftovers
  module Processors
    class Underscore
      include ComparableInstance

      def initialize(then_processor)
        @then_processor = then_processor

        freeze
      end

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

        @then_processor.process(str.underscore, current_node, matched_node, acc)
      rescue NoMethodError
        Leftovers.error <<~MESSAGE
          Tried using the String#underscore 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

      freeze
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
leftovers-0.11.1 lib/leftovers/processors/underscore.rb
leftovers-0.11.0 lib/leftovers/processors/underscore.rb
leftovers-0.10.0 lib/leftovers/processors/underscore.rb
leftovers-0.9.0 lib/leftovers/processors/underscore.rb