Module: ActiveEntity::ReadonlyAttributes::ClassMethods
- Defined in:
- lib/active_entity/readonly_attributes.rb
Instance Method Summary collapse
-
#attr_readonly(*attributes) ⇒ Object
Attributes listed as readonly will be used to create a new record but update operations will ignore these fields.
-
#readonly_attribute?(name) ⇒ Boolean
:nodoc:.
-
#readonly_attributes ⇒ Object
Returns an array of all the attributes that have been specified as readonly.
Instance Method Details
#attr_readonly(*attributes) ⇒ Object
Attributes listed as readonly will be used to create a new record but update operations will ignore these fields.
41 42 43 |
# File 'lib/active_entity/readonly_attributes.rb', line 41 def attr_readonly(*attributes) self._attr_readonly = Set.new(attributes.map(&:to_s)) + (_attr_readonly || []) end |
#readonly_attribute?(name) ⇒ Boolean
:nodoc:
50 51 52 |
# File 'lib/active_entity/readonly_attributes.rb', line 50 def readonly_attribute?(name) # :nodoc: _attr_readonly.include?(name) end |
#readonly_attributes ⇒ Object
Returns an array of all the attributes that have been specified as readonly.
46 47 48 |
# File 'lib/active_entity/readonly_attributes.rb', line 46 def readonly_attributes _attr_readonly end |