Sha256: 62c5a0d277362f65349ef958de4c4e2216786e3bd31b1ebb992a8e15c26f0e17

Contents?: true

Size: 769 Bytes

Versions: 4

Compression:

Stored size: 769 Bytes

Contents

# frozen_string_literal: true

module Leftovers
  module Processors
    class Pluralize
      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.pluralize, current_node, matched_node, acc)
      rescue ::NoMethodError
        ::Leftovers.error <<~MESSAGE
          Tried using the ::String#pluralize 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.12.2 lib/leftovers/processors/pluralize.rb
leftovers-0.12.1 lib/leftovers/processors/pluralize.rb
leftovers-0.12.0 lib/leftovers/processors/pluralize.rb
leftovers-0.11.2 lib/leftovers/processors/pluralize.rb