Module: MongoModel::AttributeMethods::ClassMethods

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

Instance Method Summary (collapse)

Instance Method Details

- (Boolean) attribute_methods_generated?

Returns:



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

def attribute_methods_generated?
  @attribute_methods_generated ||= false
end

- (Object) define_attribute_methods

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

- (Object) property(*args)



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

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

- (Object) undefine_attribute_methods(*args)



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

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