Class: Couchbase::Collection::ScanResult
- Inherits:
-
Object
- Object
- Couchbase::Collection::ScanResult
- Defined in:
- lib/couchbase/collection_options.rb
Instance Attribute Summary collapse
-
#cas ⇒ Integer?
Holds the CAS value of the fetched document.
-
#expiry ⇒ Integer?
The expiration if fetched and present.
-
#id ⇒ String
Identifier of the document.
-
#id_only ⇒ Boolean
Whether only ids are returned from this scan.
-
#transcoder ⇒ JsonTranscoder, ...
The default transcoder which should be used.
Instance Method Summary collapse
-
#content(transcoder = self.transcoder) ⇒ Object?
Decodes the content of the document using given (or default transcoder).
-
#initialize(id:, id_only:, cas: nil, expiry: nil, encoded: nil, flags: nil, transcoder: JsonTranscoder.new) {|_self| ... } ⇒ ScanResult
constructor
A new instance of ScanResult.
Constructor Details
#initialize(id:, id_only:, cas: nil, expiry: nil, encoded: nil, flags: nil, transcoder: JsonTranscoder.new) {|_self| ... } ⇒ ScanResult
Returns a new instance of ScanResult.
340 341 342 343 344 345 346 347 348 349 350 |
# File 'lib/couchbase/collection_options.rb', line 340 def initialize(id:, id_only:, cas: nil, expiry: nil, encoded: nil, flags: nil, transcoder: JsonTranscoder.new) @id = id @id_only = id_only @cas = cas @expiry = expiry @encoded = encoded @flags = flags @transcoder = transcoder yield self if block_given? end |
Instance Attribute Details
#cas ⇒ Integer?
Returns holds the CAS value of the fetched document.
331 332 333 |
# File 'lib/couchbase/collection_options.rb', line 331 def cas @cas end |
#expiry ⇒ Integer?
Returns the expiration if fetched and present.
334 335 336 |
# File 'lib/couchbase/collection_options.rb', line 334 def expiry @expiry end |
#id ⇒ String
Returns identifier of the document.
325 326 327 |
# File 'lib/couchbase/collection_options.rb', line 325 def id @id end |
#id_only ⇒ Boolean
Returns whether only ids are returned from this scan.
328 329 330 |
# File 'lib/couchbase/collection_options.rb', line 328 def id_only @id_only end |
#transcoder ⇒ JsonTranscoder, ...
Returns The default transcoder which should be used.
338 339 340 |
# File 'lib/couchbase/collection_options.rb', line 338 def transcoder @transcoder end |
Instance Method Details
#content(transcoder = self.transcoder) ⇒ Object?
Decodes the content of the document using given (or default transcoder)
357 358 359 360 361 |
# File 'lib/couchbase/collection_options.rb', line 357 def content(transcoder = self.transcoder) return nil if @encoded.nil? transcoder ? transcoder.decode(@encoded, @flags) : @encoded end |