class Packwerk::Inflections::Custom
Constants
- SUPPORTED_INFLECTION_METHODS
Attributes
inflections[RW]
Public Class Methods
new(custom_inflection_file = nil)
click to toggle source
# File lib/packwerk/inflections/custom.rb, line 13 def initialize(custom_inflection_file = nil) if custom_inflection_file && File.exist?(custom_inflection_file) @inflections = YAML.load_file(custom_inflection_file) || {} invalid_inflections = @inflections.keys - SUPPORTED_INFLECTION_METHODS raise ArgumentError, "Unsupported inflection types: #{invalid_inflections}" if invalid_inflections.any? else @inflections = [] end end
Public Instance Methods
apply_to(inflections_object)
click to toggle source
# File lib/packwerk/inflections/custom.rb, line 24 def apply_to(inflections_object) @inflections.each do |inflection_type, inflections| inflections.each do |inflection| inflections_object.public_send(inflection_type, *Array(inflection)) end end end