Sha256: 37b6e8b7e0618586d4b0079bc88b3c7bf030a15386d818f8b9a6464fb21270f1

Contents?: true

Size: 692 Bytes

Versions: 6

Compression:

Stored size: 692 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', '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/pluralize.rb
leftovers-0.7.0 lib/leftovers/value_processors/pluralize.rb
leftovers-0.6.0 lib/leftovers/value_processors/pluralize.rb
leftovers-0.5.5 lib/leftovers/value_processors/pluralize.rb
leftovers-0.5.4 lib/leftovers/value_processors/pluralize.rb
leftovers-0.5.3 lib/leftovers/value_processors/pluralize.rb