Module: Mongo::Model

Includes:
Object
Defined in:
lib/mongo/model/load.rb,
lib/mongo/model/load.rb,
lib/mongo/model/model.rb,
lib/mongo/model/scope.rb

Defined Under Namespace

Modules: Assignment, AttributeConvertors, BooleanType, Callbacks, ClassMethods, Conversion, Crud, Db, FileModel, IdentityMap, Misc, QueryMixin, Rails, Scope, Validation Classes: Component, Query

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.originalsObject



82
83
84
# File 'lib/mongo/model/model.rb', line 82

def originals
  @originals ||= {}
end

Instance Method Details

#model_eq?(o) ⇒ Boolean

Returns:



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/mongo/model/model.rb', line 18

def model_eq? o
  return true if equal? o
  return false unless o.is_a? Mongo::Model

  variables = {}.tap do |h|
    persistent_instance_variable_names.each{|n| h[n] = instance_variable_get(n)}
  end

  o_variables = {}.tap do |h|
    o.persistent_instance_variable_names.each{|n| h[n] = o.instance_variable_get(n)}
  end

  variables == o_variables
end

#model_eql?(o) ⇒ Boolean

Equality.

Returns:



13
14
15
16
# File 'lib/mongo/model/model.rb', line 13

def model_eql? o
  return true if equal? o
  self.class == o.class and self == o
end