Class: Couchbase::Collection::LookupInResult

Inherits:
Object
  • Object
show all
Defined in:
lib/couchbase/collection_options.rb,
/Users/sergey.auseyau/code/couchbase-ruby-client/lib/couchbase/collection_options.rb
more...

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of LookupInResult.

Yield Parameters:

[View source]

343
344
345
# File 'lib/couchbase/collection_options.rb', line 343

def initialize
  yield self if block_given?
end

Instance Attribute Details

#casInteger

Returns holds the CAS value of the fetched document.

Returns:

  • (Integer)

    holds the CAS value of the fetched document


319
320
321
# File 'lib/couchbase/collection_options.rb', line 319

def cas
  @cas
end

#encodedArray<SubDocumentField>

Returns holds the encoded subdocument responses.

Returns:

  • (Array<SubDocumentField>)

    holds the encoded subdocument responses


340
341
342
# File 'lib/couchbase/collection_options.rb', line 340

def encoded
  @encoded
end

#transcoderJsonTranscoder

Returns The default transcoder which should be used.

Returns:


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

Parameters:

  • index (Integer)

    the index of the subdocument value to decode

Returns:

  • (Object)

    the decoded

[View source]

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

Parameters:

  • index (Integer)

    the index of the subdocument value to check

Returns:

  • (Boolean)

    true if a value is present at the index, false otherwise

[View source]

335
336
337
# File 'lib/couchbase/collection_options.rb', line 335

def exists?(index)
  !encoded[index].nil? && encoded[index].exists
end