Class: Couchbase::Collection::LookupInResult

Inherits:
Object
  • Object
show all
Defined in:
lib/couchbase/collection_options.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of LookupInResult.

Yield Parameters:



158
159
160
161
# File 'lib/couchbase/collection_options.rb', line 158

def initialize
  @deleted = false
  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



134
135
136
# File 'lib/couchbase/collection_options.rb', line 134

def cas
  @cas
end

#encodedArray<SubDocumentField>

Returns holds the encoded subdocument responses.

Returns:

  • (Array<SubDocumentField>)

    holds the encoded subdocument responses



155
156
157
# File 'lib/couchbase/collection_options.rb', line 155

def encoded
  @encoded
end

#transcoderJsonTranscoder

Returns The default transcoder which should be used.

Returns:



164
165
166
# File 'lib/couchbase/collection_options.rb', line 164

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



141
142
143
# File 'lib/couchbase/collection_options.rb', line 141

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



150
151
152
# File 'lib/couchbase/collection_options.rb', line 150

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