Class: Couchbase::Collection::GetResult
- Inherits:
-
Object
- Object
- Couchbase::Collection::GetResult
- Extended by:
- Gem::Deprecate
- Defined in:
- lib/couchbase/collection_options.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#cas ⇒ Integer
Holds the CAS value of the fetched document.
-
#error ⇒ Error::CouchbaseError?
Error associated with the result, or nil (used in #get_multi).
-
#expiry ⇒ Integer
deprecated
Deprecated.
Use #expiry_time
-
#id ⇒ String?
Identifier of the document (used for #get_multi).
-
#transcoder ⇒ JsonTranscoder
The default transcoder which should be used.
Instance Method Summary collapse
-
#content(transcoder = self.transcoder) ⇒ Object
Decodes the content of the document using given (or default transcoder).
-
#expiry_time ⇒ Time
Time when the document will expire.
-
#initialize {|self| ... } ⇒ GetResult
constructor
A new instance of GetResult.
-
#success? ⇒ Boolean
True if error was not associated with the result (useful for multi-operations).
Constructor Details
#initialize {|self| ... } ⇒ GetResult
Returns a new instance of GetResult.
67 68 69 70 71 72 |
# File 'lib/couchbase/collection_options.rb', line 67 def initialize @expiry = nil @error = nil @id = nil yield self if block_given? end |
Instance Attribute Details
#cas ⇒ Integer
Returns holds the CAS value of the fetched document.
32 33 34 |
# File 'lib/couchbase/collection_options.rb', line 32 def cas @cas end |
#error ⇒ Error::CouchbaseError?
Returns error associated with the result, or nil (used in Couchbase::Collection#get_multi).
38 39 40 |
# File 'lib/couchbase/collection_options.rb', line 38 def error @error end |
#expiry ⇒ Integer
Use #expiry_time
Returns the expiration if fetched and present.
83 84 85 |
# File 'lib/couchbase/collection_options.rb', line 83 def expiry # rubocop:disable Style/TrivialAccessors will be removed in next major release @expiry end |
#id ⇒ String?
Returns identifier of the document (used for Couchbase::Collection#get_multi).
41 42 43 |
# File 'lib/couchbase/collection_options.rb', line 41 def id @id end |
#transcoder ⇒ JsonTranscoder
Returns The default transcoder which should be used.
79 80 81 |
# File 'lib/couchbase/collection_options.rb', line 79 def transcoder @transcoder end |
Instance Method Details
#content(transcoder = self.transcoder) ⇒ Object
Decodes the content of the document using given (or default transcoder)
57 58 59 |
# File 'lib/couchbase/collection_options.rb', line 57 def content(transcoder = self.transcoder) transcoder ? transcoder.decode(@encoded, @flags) : @encoded end |
#expiry_time ⇒ Time
Returns time when the document will expire.
62 63 64 |
# File 'lib/couchbase/collection_options.rb', line 62 def expiry_time Time.at(@expiry) if @expiry end |
#success? ⇒ Boolean
Returns true if error was not associated with the result (useful for multi-operations).
44 45 46 |
# File 'lib/couchbase/collection_options.rb', line 44 def success? !error end |