Class: Couchbase::Collection::GetResult

Inherits:
Object
  • Object
show all
Extended by:
Gem::Deprecate
Defined in:
lib/couchbase/collection_options.rb

Direct Known Subclasses

GetReplicaResult

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|self| ... } ⇒ GetResult

Returns a new instance of GetResult.

Yield Parameters:



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

#casInteger



32
33
34
# File 'lib/couchbase/collection_options.rb', line 32

def cas
  @cas
end

#encodedString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns The encoded content when loading the document.



50
51
52
# File 'lib/couchbase/collection_options.rb', line 50

def encoded
  @encoded
end

#errorError::CouchbaseError?



38
39
40
# File 'lib/couchbase/collection_options.rb', line 38

def error
  @error
end

#expiryInteger

Deprecated.

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

#flagsInteger

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns The flags from the operation.



76
77
78
# File 'lib/couchbase/collection_options.rb', line 76

def flags
  @flags
end

#idString?



41
42
43
# File 'lib/couchbase/collection_options.rb', line 41

def id
  @id
end

#transcoderJsonTranscoder



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_timeTime



62
63
64
# File 'lib/couchbase/collection_options.rb', line 62

def expiry_time
  Time.at(@expiry) if @expiry
end

#success?Boolean



44
45
46
# File 'lib/couchbase/collection_options.rb', line 44

def success?
  !error
end