Module: MongoModel::AttributeMethods::ClassMethods

Defined in:
lib/mongomodel/concerns/attribute_methods.rb

Instance Method Summary collapse

Instance Method Details

#attribute_methods_generated?Boolean

Returns:



17
18
19
# File 'lib/mongomodel/concerns/attribute_methods.rb', line 17

def attribute_methods_generated?
  @attribute_methods_generated ||= false
end

#define_attribute_methodsObject

Generates all the attribute related methods for defined properties accessors, mutators and query methods.



10
11
12
13
14
15
# File 'lib/mongomodel/concerns/attribute_methods.rb', line 10

def define_attribute_methods
  return if attribute_methods_generated?
  superclass.define_attribute_methods unless abstract_class?
  super(properties.keys)
  @attribute_methods_generated = true
end

#property(*args) ⇒ Object



26
27
28
29
30
# File 'lib/mongomodel/concerns/attribute_methods.rb', line 26

def property(*args)
  property = super
  undefine_attribute_methods
  property
end

#undefine_attribute_methods(*args) ⇒ Object



21
22
23
24
# File 'lib/mongomodel/concerns/attribute_methods.rb', line 21

def undefine_attribute_methods(*args)
  super
  @attribute_methods_generated = false
end