Today we have
require "dry/inflector"
inflector = Dry::Inflector.new
inflector.camelize("first_name") # => "FirstName"
In some set people need the lower version of camelize, where only the first character of the sentence is not uppercased.
ActiveSupport has provide this as an optional argument.
# camelize(term, uppercase_first_letter = true)
camelize('active_model') # => "ActiveModel"
camelize('active_model', false) # => "activeModel"
Details at: http://api.rubyonrails.org/classes/ActiveSupport/Inflector.html#method-i-camelize
At a previous discussion at the flexus repo, @pabloh has suggested we should provide the same, but with a keyword argument, like this:
inflector.camelize('active_model', lower: true) # => "activeModel"
Details at: https://github.com/Ptico/flexus/issues/3
I have suggested that we shouldn’t go to this polymorphic behaviour through arguments, instead we should provide 2 different methods that clearly states what the method is about.
With the “camelize / camelize with lower set to true” approach, when facing a simple camelize without the argument, one will probably have to make some effort to remember what is the “default” camelize behavior, lower or upper.
With the “camelize_lower / camelize_upper” without any argument, we have a more clear api, in my humble opinion.
As a middle way approach, we could favor the camelize_lower / camelize_upper as the official and documented api. But, keep on providing the old camelize behavior as alias to these official methods. Then we could have the best of both worlds.
@jodosha, I hope this clarifies the issue a little bit.