Class: Couchbase::Collection::LookupInResult
- Inherits:
-
Object
- Object
- Couchbase::Collection::LookupInResult
- Defined in:
- lib/couchbase/collection_options.rb,
/Users/sergey.auseyau/code/couchbase-ruby-client/lib/couchbase/collection_options.rb more...
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.
343 344 345 |
# File 'lib/couchbase/collection_options.rb', line 343 def initialize yield self if block_given? end |
Instance Attribute Details
#cas ⇒ Integer
Returns holds the CAS value of the fetched document.
319 320 321 |
# File 'lib/couchbase/collection_options.rb', line 319 def cas @cas end |
#encoded ⇒ Array<SubDocumentField>
Returns holds the encoded subdocument responses.
340 341 342 |
# File 'lib/couchbase/collection_options.rb', line 340 def encoded @encoded end |
#transcoder ⇒ JsonTranscoder
Returns The default transcoder which should be used.
348 349 350 |
# File 'lib/couchbase/collection_options.rb', line 348 def transcoder @transcoder end |
Instance Method Details
#content(index, transcoder = self.transcoder) ⇒ Object
Decodes the content at the given index
326 327 328 |
# File 'lib/couchbase/collection_options.rb', line 326 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
335 336 337 |
# File 'lib/couchbase/collection_options.rb', line 335 def exists?(index) !encoded[index].nil? && encoded[index].exists end |