Module: CouchRest::Model::CastedBy

Extended by:
ActiveSupport::Concern
Included in:
Base, CastedArray, CastedHash
Defined in:
lib/couchrest/model/casted_by.rb

Instance Method Summary collapse

Instance Method Details

#base_docObject

Gets a reference to the actual document in the DB Calls up to the next document if there is one, Otherwise we’re at the top and we return self



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

def base_doc
  return self if base_doc?
  casted_by ? casted_by.base_doc : nil
end

#base_doc?Boolean

Checks if we’re the top document

Returns:

  • (Boolean)


19
20
21
# File 'lib/couchrest/model/casted_by.rb', line 19

def base_doc?
  !casted_by
end