Module: MongoModel::DocumentParent

Extended by:
ActiveSupport::Concern
Included in:
Collection, EmbeddedDocument
Defined in:
lib/mongomodel/concerns/document_parent.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) parent_document



5
6
7
8
9
10
11
12
13
14
# File 'lib/mongomodel/concerns/document_parent.rb', line 5

def parent_document
  if @_parent_document.is_a?(Proc)
    case @_parent_document.arity
    when 0 then @_parent_document.call
    else        @_parent_document.call(self)
    end
  else
    @_parent_document
  end
end

- (Object) parent_document=(doc)



16
17
18
# File 'lib/mongomodel/concerns/document_parent.rb', line 16

def parent_document=(doc)
  @_parent_document = doc
end