Sha256: 81d75dfb11834f5e35cadc087e0a71e1f0624f665bbd308f3e3e1e0da8f522a2
Contents?: true
Size: 891 Bytes
Versions: 1
Compression:
Stored size: 891 Bytes
Contents
module PassiveSupport class ModelName < String attr_reader :singular, :plural, :element, :collection, :partial_path alias_method :cache_key, :collection def initialize(name) super @singular = PassiveSupport::Inflector.underscore(self).tr('/', '_').freeze @plural = PassiveSupport::Inflector.pluralize(@singular).freeze @element = PassiveSupport::Inflector.underscore(PassiveSupport::Inflector.demodulize(self)).freeze @collection = PassiveSupport::Inflector.tableize(self).freeze @partial_path = "#{@collection}/#{@element}".freeze end end module CoreExtensions module Module # Returns an PassiveSupport::ModelName object for module. It can be # used to retrieve all kinds of naming-related information. def model_name @model_name ||= ::PassiveSupport::ModelName.new(name) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
emipair-delayed_job-2.0.3.1 | lib/passive_support/core_ext/module/model_naming.rb |