Module: MongoMapper::Plugins::Protected::ClassMethods
- Defined in:
- lib/mongo_mapper/plugins/protected.rb
Instance Method Summary collapse
- #attr_protected(*attrs) ⇒ Object
- #key(*args) ⇒ Object
- #protected_attributes ⇒ Object
- #protected_attributes? ⇒ Boolean
Instance Method Details
#attr_protected(*attrs) ⇒ Object
8 9 10 11 |
# File 'lib/mongo_mapper/plugins/protected.rb', line 8 def attr_protected(*attrs) raise AccessibleOrProtected.new(name) if try(:accessible_attributes?) self.write_inheritable_attribute(:attr_protected, Set.new(attrs) + (protected_attributes || [])) end |
#key(*args) ⇒ Object
21 22 23 24 25 |
# File 'lib/mongo_mapper/plugins/protected.rb', line 21 def key(*args) key = super attr_protected key.name.to_sym if key.[:protected] key end |
#protected_attributes ⇒ Object
13 14 15 |
# File 'lib/mongo_mapper/plugins/protected.rb', line 13 def protected_attributes self.read_inheritable_attribute(:attr_protected) end |
#protected_attributes? ⇒ Boolean
17 18 19 |
# File 'lib/mongo_mapper/plugins/protected.rb', line 17 def protected_attributes? !protected_attributes.nil? end |