Currently, this is just pulling model_class.model_name.name and then demodulizing it. Conceptually, it might be useful to have a (yml-based) config setting for class_name_map_func which, if set, would be to_proc'd; default would be demodulize. This could then be invoked from #resource_name to get the proper version of the name.
As a nice extension to this, when configuring Opium via ruby would likely allow for the following without any extra effort within #resource_name:
Opium.configure do |config|
# Take the first character from each module and mash them as a prefix
config.class_name_map_func = ->( name ) { name.split('::')[0..-2].map {|n| n[0]}.join + name.demodulize }
end
Currently, this is just pulling
model_class.model_name.name
and then demodulizing it. Conceptually, it might be useful to have a (yml-based) config setting forclass_name_map_func
which, if set, would be to_proc'd; default would bedemodulize
. This could then be invoked from #resource_name to get the proper version of the name.As a nice extension to this, when configuring Opium via ruby would likely allow for the following without any extra effort within #resource_name: