Module: MongoMapper::Plugins::Protected::ClassMethods

Defined in:
lib/novelys_mongo_mapper/plugins/protected.rb

Instance Method Summary collapse

Instance Method Details

#attr_protected(*attrs) ⇒ Object



5
6
7
# File 'lib/novelys_mongo_mapper/plugins/protected.rb', line 5

def attr_protected(*attrs)
  self.write_inheritable_attribute(:attr_protected, Set.new(attrs) + (protected_attributes || []))
end

#key(*args) ⇒ Object



13
14
15
16
17
# File 'lib/novelys_mongo_mapper/plugins/protected.rb', line 13

def key(*args)
  key = super
  attr_protected key.name.to_sym if key.options[:protected]
  key
end

#protected_attributesObject



9
10
11
# File 'lib/novelys_mongo_mapper/plugins/protected.rb', line 9

def protected_attributes
  self.read_inheritable_attribute(:attr_protected)
end