module
CouchDB::DocumentHelper
Overview
Utility module for low-level document operations.
Prefer instance methods on Document for new code (doc.next_rev, doc.rev_num,
doc.deleted?). This module is provided for callers that work with documents
generically and may also be used by adapter internals.
Defined in:
couchdb/document.crClass Method Summary
-
.deleted?(doc : Document) : Bool
Returns
truewhen the document'sdeletedfield istrue. -
.next_rev(doc : Document) : String
Computes the next revision for
docusing the CouchDB"N-<md5>"scheme. -
.rev_num(rev : String) : Int32
Parses the generation number from a revision string (e.g.
Class Method Detail
Returns true when the document's deleted field is true.
Computes the next revision for doc using the CouchDB "N-<md5>" scheme.
The hash is derived from the document JSON with _rev removed so that the
revision string is deterministic given the same document content.
Parses the generation number from a revision string (e.g. "3-abc" → 3).
Returns 0 for malformed input.