Sha256: c74d673f820c4a6e0178ac73bf7267fd01959bc507d9766bdff11f4f9787f10f

Contents?: true

Size: 672 Bytes

Versions: 7

Compression:

Stored size: 672 Bytes

Contents

# frozen_string_literal: true

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

        freeze
      end

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

        @then_processor.process(str.pluralize, node, method_node)
      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/core_ext/string'` to your .leftovers.yml
        MESSAGE
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
leftovers-0.5.2 lib/leftovers/value_processors/pluralize.rb
leftovers-0.5.1 lib/leftovers/value_processors/pluralize.rb
leftovers-0.5.0 lib/leftovers/value_processors/pluralize.rb
leftovers-0.4.3 lib/leftovers/value_processors/pluralize.rb
leftovers-0.4.2 lib/leftovers/value_processors/pluralize.rb
leftovers-0.4.1 lib/leftovers/value_processors/pluralize.rb
leftovers-0.4.0 lib/leftovers/value_processors/pluralize.rb