Sha256: f65916073677c57a4f6b4d7bb6c1f8c86536de3400907df280b0381fcb03b2c3

Contents?: true

Size: 689 Bytes

Versions: 6

Compression:

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