Module: Ripple::EmbeddedDocument

Extended by:
ActiveSupport::Concern
Includes:
Translation
Defined in:
lib/ripple/embedded_document.rb,
lib/ripple/embedded_document/finders.rb,
lib/ripple/embedded_document/persistence.rb,
lib/ripple/embedded_document/around_callbacks.rb

Overview

Represents a document model that is composed into or stored in a parent Document. Embedded documents may also embed other documents, have callbacks and validations, but are solely dependent on the parent Document.

Defined Under Namespace

Modules: AroundCallbacks, ClassMethods, Finders, Persistence

Instance Method Summary collapse

Methods included from Translation

#i18n_scope

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



50
51
52
53
54
# File 'lib/ripple/embedded_document.rb', line 50

def ==(other)
  self.class == other.class &&
    _parent_document == other._parent_document &&
    serializable_hash == other.serializable_hash
end

#hashObject



57
58
59
60
61
# File 'lib/ripple/embedded_document.rb', line 57

def hash
  hash  = self.class.hash ^ _parent_document.class.hash ^ serializable_hash.to_s.hash
  hash ^= _parent_document.key.hash if _parent_document.respond_to?(:key)
  hash
end