Sha256: 7d6af0dec441c6646b9a7cc43a3a5ffb4a45996e304b591647e222d2df2aff1e

Contents?: true

Size: 433 Bytes

Versions: 17

Compression:

Stored size: 433 Bytes

Contents

# frozen_string_literal: true

module Pennyworth
  # Overrides any string to desired form if matched, otherwise answers the original string.
  class Inflector
    DEFAULTS = Array(Container[:configuration].inflections).reduce({}, :merge)

    def initialize overrides = DEFAULTS
      @overrides = overrides
    end

    def call(key) = overrides.fetch(key) { |fallback| fallback }

    private

    attr_reader :overrides
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
pennyworth-16.7.0 lib/pennyworth/inflector.rb
pennyworth-16.5.0 lib/pennyworth/inflector.rb
pennyworth-16.4.0 lib/pennyworth/inflector.rb
pennyworth-16.3.0 lib/pennyworth/inflector.rb
pennyworth-16.2.0 lib/pennyworth/inflector.rb
pennyworth-16.1.0 lib/pennyworth/inflector.rb
pennyworth-16.0.0 lib/pennyworth/inflector.rb
pennyworth-15.4.1 lib/pennyworth/inflector.rb
pennyworth-15.4.0 lib/pennyworth/inflector.rb
pennyworth-15.3.0 lib/pennyworth/inflector.rb
pennyworth-15.2.0 lib/pennyworth/inflector.rb
pennyworth-15.1.1 lib/pennyworth/inflector.rb
pennyworth-15.1.0 lib/pennyworth/inflector.rb
pennyworth-15.0.3 lib/pennyworth/inflector.rb
pennyworth-15.0.2 lib/pennyworth/inflector.rb
pennyworth-15.0.1 lib/pennyworth/inflector.rb
pennyworth-15.0.0 lib/pennyworth/inflector.rb