Class: Couchbase::Result
- Inherits:
-
Object
- Object
- Couchbase::Result
- Defined in:
- lib/couchbase/result.rb
Instance Attribute Summary collapse
-
#error ⇒ Object
Returns the value of attribute error.
Instance Method Summary collapse
- #cas ⇒ Object
-
#initialize(attrs = {}) ⇒ Result
constructor
A new instance of Result.
- #key ⇒ Object
- #node ⇒ Object
- #operation ⇒ Object
- #success? ⇒ Boolean
- #value ⇒ Object
Constructor Details
#initialize(attrs = {}) ⇒ Result
Returns a new instance of Result.
6 7 8 9 10 11 |
# File 'lib/couchbase/result.rb', line 6 def initialize(attrs = {}) @bucket = attrs[:bucket] @key = attrs[:key] @operation = attrs[:op] @future = attrs[:future] end |
Instance Attribute Details
#error ⇒ Object
Returns the value of attribute error.
4 5 6 |
# File 'lib/couchbase/result.rb', line 4 def error @error end |
Instance Method Details
#cas ⇒ Object
35 36 37 |
# File 'lib/couchbase/result.rb', line 35 def cas @future.getCas if @future.respond_to?(:getCas) end |
#key ⇒ Object
25 26 27 |
# File 'lib/couchbase/result.rb', line 25 def key @key || @future.getKey end |
#node ⇒ Object
39 40 41 |
# File 'lib/couchbase/result.rb', line 39 def node end |
#operation ⇒ Object
13 14 15 |
# File 'lib/couchbase/result.rb', line 13 def operation @operation end |
#success? ⇒ Boolean
17 18 19 |
# File 'lib/couchbase/result.rb', line 17 def success? @future.get end |
#value ⇒ Object
29 30 31 32 33 |
# File 'lib/couchbase/result.rb', line 29 def value @future.get rescue MultiJson::LoadError nil end |