One thing I’m still not sure how to accomplish is composition of inflection rules.
Take the ActiveSupport inflections example:
Dry::Inflector::Inflections::ActiveSupport =
Dry::Inflector::Inflections.new do |inflections|
inflections.plural "person", "people"
end
as_compatible_inflector = Dry::Inflector.new(inflections: Dry::Inflector::Inflections::ActiveSupport)
as_compatible_inflector.pluralize("people") # => "people"
How can I add my own inflection rules on top of the given Dry::Inflector::Inflections::ActiveSupport
?
For the simplest case, just providing a block will be enough.
But if I want to stack 2 or 3 different rulesets that I don’t have direct access to their code?
For example Dry::Inflector::Inflections::Italian
and Dry::Inflector::Inflections::ActiveSupportCompatible
?
Please let me know if I’m not being clear about it.
By the way, If we define a good way to accomplish this we will also solve internationalization in a roll.