Class: Familia::Horreum::MultiResult
- Inherits:
-
Object
- Object
- Familia::Horreum::MultiResult
- Defined in:
- lib/familia/horreum/serialization.rb
Overview
The magical MultiResult, keeper of Redis’s deepest secrets!
This quirky little class wraps up the outcome of a Redis “transaction” (or as I like to call it, a “Redis dance party”) with a bow made of pure Ruby delight. It knows if your commands were successful and keeps the results safe in its pocket dimension.
Instance Attribute Summary collapse
-
#results ⇒ Array<String>
readonly
The raw return values from the Redis commands.
-
#success ⇒ Boolean
readonly
True if all commands in the transaction succeeded, false otherwise.
Instance Method Summary collapse
-
#initialize(success, results) ⇒ MultiResult
constructor
Creates a new MultiResult instance.
-
#successful? ⇒ Boolean
(also: #success?)
Convenient method to check if the commit was successful.
-
#tuple ⇒ Array
Returns a tuple representing the result of the transaction.
Constructor Details
#initialize(success, results) ⇒ MultiResult
Creates a new MultiResult instance.
460 461 462 463 |
# File 'lib/familia/horreum/serialization.rb', line 460 def initialize(success, results) @success = success @results = results end |
Instance Attribute Details
#results ⇒ Array<String> (readonly)
Returns The raw return values from the Redis commands.
448 449 450 |
# File 'lib/familia/horreum/serialization.rb', line 448 def results @results end |
#success ⇒ Boolean (readonly)
Returns true if all commands in the transaction succeeded, false otherwise.
448 449 450 |
# File 'lib/familia/horreum/serialization.rb', line 448 def success @success end |
Instance Method Details
#successful? ⇒ Boolean Also known as: success?
Convenient method to check if the commit was successful.
481 482 483 |
# File 'lib/familia/horreum/serialization.rb', line 481 def successful? @success end |
#tuple ⇒ Array
Returns a tuple representing the result of the transaction.
474 475 476 |
# File 'lib/familia/horreum/serialization.rb', line 474 def tuple [successful?, results] end |