Sha256: 06fb8402c9d41bf8bf94f895518ca2c31d789230616c98005c0bee7170a5831b

Contents?: true

Size: 669 Bytes

Versions: 7

Compression:

Stored size: 669 Bytes

Contents

# frozen_string_literal: true

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

        freeze
      end

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

        @then_processor.process(str.titleize, node, method_node)
      rescue NoMethodError
        Leftovers.error <<~MESSAGE
          Tried using the String#titleize 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/titleize.rb
leftovers-0.5.1 lib/leftovers/value_processors/titleize.rb
leftovers-0.5.0 lib/leftovers/value_processors/titleize.rb
leftovers-0.4.3 lib/leftovers/value_processors/titleize.rb
leftovers-0.4.2 lib/leftovers/value_processors/titleize.rb
leftovers-0.4.1 lib/leftovers/value_processors/titleize.rb
leftovers-0.4.0 lib/leftovers/value_processors/titleize.rb