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.
-
#deleted ⇒ Object
Returns the value of attribute deleted.
-
#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.
-
#deleted? ⇒ Boolean
True if the document is a tombstone (created in deleted state).
-
#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.
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
#cas ⇒ Integer
Returns holds the CAS value of the fetched document.
124 125 126 |
# File 'lib/couchbase/collection_options.rb', line 124 def cas @cas end |
#deleted ⇒ Object
Returns the value of attribute deleted.
151 152 153 |
# File 'lib/couchbase/collection_options.rb', line 151 def deleted @deleted end |
#encoded ⇒ Array<SubDocumentField>
Returns holds the encoded subdocument responses.
154 155 156 |
# File 'lib/couchbase/collection_options.rb', line 154 def encoded @encoded end |
#transcoder ⇒ JsonTranscoder
Returns The default transcoder which should be used.
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
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).
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
140 141 142 |
# File 'lib/couchbase/collection_options.rb', line 140 def exists?(index) !encoded[index].nil? && encoded[index].exists end |