Class: Kvom::Adapter::Document

Inherits:
Object
  • Object
show all
Defined in:
lib/kvom/adapter/document.rb

Direct Known Subclasses

DynamodbDocument, FilesystemDocument

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



8
9
10
# File 'lib/kvom/adapter/document.rb', line 8

def key
  @key
end

#persisted_revisionObject (readonly)

Returns the value of attribute persisted_revision.



8
9
10
# File 'lib/kvom/adapter/document.rb', line 8

def persisted_revision
  @persisted_revision
end

Instance Method Details

#[](name) ⇒ Object



10
11
12
# File 'lib/kvom/adapter/document.rb', line 10

def [](name)
  attributes[name]
end

#[]=(name, value) ⇒ Object



14
15
16
# File 'lib/kvom/adapter/document.rb', line 14

def []=(name, value)
  attributes[name] = value
end

#update_revisionObject



18
19
20
21
22
# File 'lib/kvom/adapter/document.rb', line 18

def update_revision
  attributes["@rev"] = SecureRandom.hex(8)
  yield
  @persisted_revision = attributes["@rev"]
end