Module: NCore::Identity::ClassMethods
- Defined in:
- lib/ncore/identity.rb
Instance Method Summary collapse
- #attrib_name ⇒ Object (also: #json_root)
- #class_name ⇒ Object
- #i18n_scope ⇒ Object
-
#model_name ⇒ Object
make NCore::SomeResource.model_name do the right thing.
- #module_name ⇒ Object
Instance Method Details
#attrib_name ⇒ Object Also known as: json_root
14 15 16 |
# File 'lib/ncore/identity.rb', line 14 def attrib_name class_name.underscore end |
#class_name ⇒ Object
6 7 8 |
# File 'lib/ncore/identity.rb', line 6 def class_name self.name.split('::')[-1] end |
#i18n_scope ⇒ Object
19 20 21 |
# File 'lib/ncore/identity.rb', line 19 def i18n_scope module_parent::Api.i18n_scope end |
#model_name ⇒ Object
make NCore::SomeResource.model_name do the right thing
24 25 26 |
# File 'lib/ncore/identity.rb', line 24 def model_name ::ActiveModel::Name.new(self, nil, ::ActiveSupport::Inflector.demodulize(self)) end |
#module_name ⇒ Object
10 11 12 |
# File 'lib/ncore/identity.rb', line 10 def module_name self.name.split('::')[0..-2].join('::') end |