class Packwerk::Inflector

Public Class Methods

default() click to toggle source
# File lib/packwerk/inflector.rb, line 11
def default
  @default ||= new(custom_inflector: Inflections::Custom.new)
end
from_file(inflections_file) click to toggle source
# File lib/packwerk/inflector.rb, line 16
def from_file(inflections_file)
  new(custom_inflector: Inflections::Custom.new(inflections_file))
end
new(custom_inflector:) click to toggle source
# File lib/packwerk/inflector.rb, line 29
def initialize(custom_inflector:)
  @inflections = ::ActiveSupport::Inflector::Inflections.new

  Inflections::Default.apply_to(@inflections)
  custom_inflector.apply_to(@inflections)
end

Public Instance Methods

inflections(_ = nil) click to toggle source
# File lib/packwerk/inflector.rb, line 44
def inflections(_ = nil)
  @inflections
end
pluralize(word, count = nil) click to toggle source
Calls superclass method
# File lib/packwerk/inflector.rb, line 36
def pluralize(word, count = nil)
  if count == 1
    singularize(word)
  else
    super(word)
  end
end