OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/config/constants/open_project/inflector.rb

40 lines
699 B

module OpenProject
class Inflector < Zeitwerk::GemInflector
alias_method :default_inflect, :camelize
def camelize(basename, abspath)
self.class.camelize_rules.each do |rule|
name = instance_exec(basename, abspath, &rule)
return name if name
end
super
end
private
def overrides
self.class.inflections.merge(super)
end
class << self
def rule(&block)
camelize_rules << block
end
def camelize_rules
@camelize_rules ||= []
end
def inflections
@inflections ||= {}
end
def inflection(overrides)
inflections.merge!(overrides)
end
end
end
end