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.
23 24 25 26 27 28 |
# File 'lib/couchbase/result.rb', line 23 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.
21 22 23 |
# File 'lib/couchbase/result.rb', line 21 def error @error end |
Instance Method Details
#cas ⇒ Object
52 53 54 |
# File 'lib/couchbase/result.rb', line 52 def cas @future.getCas if @future.respond_to?(:getCas) end |
#key ⇒ Object
42 43 44 |
# File 'lib/couchbase/result.rb', line 42 def key @key || @future.getKey end |
#node ⇒ Object
56 57 58 |
# File 'lib/couchbase/result.rb', line 56 def node end |
#operation ⇒ Object
30 31 32 |
# File 'lib/couchbase/result.rb', line 30 def operation @operation end |
#success? ⇒ Boolean
34 35 36 |
# File 'lib/couchbase/result.rb', line 34 def success? @future.get end |
#value ⇒ Object
46 47 48 49 50 |
# File 'lib/couchbase/result.rb', line 46 def value @future.get rescue MultiJson::LoadError nil end |