Module: Mobility::Plugins::Attributes::ClassMethods
- Defined in:
- lib/mobility/plugins/attributes.rb
Instance Method Summary collapse
- #inherited(klass) ⇒ Object
-
#mobility_attribute?(name) ⇒ Boolean
Return true if attribute name is translated on this model.
-
#mobility_attributes ⇒ Array<String>
Return translated attribute names on this model.
Instance Method Details
#inherited(klass) ⇒ Object
54 55 56 57 58 |
# File 'lib/mobility/plugins/attributes.rb', line 54 def inherited(klass) super attrs = mobility_attributes.freeze # ensure attributes are not modified after being inherited klass.class_eval { @mobility_attributes = attrs.dup } end |
#mobility_attribute?(name) ⇒ Boolean
Return true if attribute name is translated on this model.
44 45 46 |
# File 'lib/mobility/plugins/attributes.rb', line 44 def mobility_attribute?(name) mobility_attributes.include?(name.to_s) end |
#mobility_attributes ⇒ Array<String>
Return translated attribute names on this model.
50 51 52 |
# File 'lib/mobility/plugins/attributes.rb', line 50 def mobility_attributes @mobility_attributes ||= [] end |