Class: Couchbase::Collection::LookupInResult
- Inherits:
-
Object
- Object
- Couchbase::Collection::LookupInResult
- Defined in:
- lib/couchbase/collection_options.rb
Instance Attribute Summary collapse
-
#cas ⇒ Integer
Holds the CAS value of the fetched document.
-
#encoded ⇒ Array<SubDocumentField>
Holds the encoded subdocument responses.
-
#transcoder ⇒ JsonTranscoder
The default transcoder which should be used.
Instance Method Summary collapse
-
#content(index, transcoder = self.transcoder) ⇒ Object
Decodes the content at the given index.
-
#exists?(index) ⇒ Boolean
Allows to check if a value at the given index exists.
-
#initialize {|self| ... } ⇒ LookupInResult
constructor
A new instance of LookupInResult.
Constructor Details
#initialize {|self| ... } ⇒ LookupInResult
Returns a new instance of LookupInResult.
313 314 315 |
# File 'lib/couchbase/collection_options.rb', line 313 def initialize yield self if block_given? end |
Instance Attribute Details
#cas ⇒ Integer
Returns holds the CAS value of the fetched document.
289 290 291 |
# File 'lib/couchbase/collection_options.rb', line 289 def cas @cas end |
#encoded ⇒ Array<SubDocumentField>
Returns holds the encoded subdocument responses.
310 311 312 |
# File 'lib/couchbase/collection_options.rb', line 310 def encoded @encoded end |
#transcoder ⇒ JsonTranscoder
Returns The default transcoder which should be used.
318 319 320 |
# File 'lib/couchbase/collection_options.rb', line 318 def transcoder @transcoder end |
Instance Method Details
#content(index, transcoder = self.transcoder) ⇒ Object
Decodes the content at the given index
296 297 298 |
# File 'lib/couchbase/collection_options.rb', line 296 def content(index, transcoder = self.transcoder) transcoder.decode(get_field_at_index(index).value, :json) end |
#exists?(index) ⇒ Boolean
Allows to check if a value at the given index exists
305 306 307 |
# File 'lib/couchbase/collection_options.rb', line 305 def exists?(index) !encoded[index].nil? && encoded[index].exists end |