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]

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

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


124
125
126
# File 'lib/couchbase/collection_options.rb', line 124

def cas
  @cas
end

#deletedObject

Returns the value of attribute deleted.


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

def deleted
  @deleted
end

#encodedArray<SubDocumentField>

Returns holds the encoded subdocument responses.

Returns:

  • (Array<SubDocumentField>)

    holds the encoded subdocument responses


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

def encoded
  @encoded
end

#transcoderJsonTranscoder

Returns The default transcoder which should be used.

Returns:


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

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]

131
132
133
# File 'lib/couchbase/collection_options.rb', line 131

def content(index, transcoder = self.transcoder)
  transcoder.decode(get_field_at_index(index).value, :json)
end

#deleted?Boolean

Returns true if the document is a tombstone (created in deleted state).

Returns:

  • (Boolean)

    true if the document is a tombstone (created in deleted state)

See Also:

[View source]

147
148
149
# File 'lib/couchbase/collection_options.rb', line 147

def deleted?
  @deleted
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]

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

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