Class: Familia::Horreum::MultiResult
- Inherits:
-
Object
- Object
- Familia::Horreum::MultiResult
- Defined in:
- lib/familia/horreum/serialization.rb
Overview
Represents the result of a multiple Redis commands.
This class encapsulates the outcome of a Redis “transaction”, providing both a success indicator and the raw results from the Redis commands executed during the transaction (“MULTI”).
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.
416 417 418 419 |
# File 'lib/familia/horreum/serialization.rb', line 416 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.
404 405 406 |
# File 'lib/familia/horreum/serialization.rb', line 404 def results @results end |
#success ⇒ Boolean (readonly)
Returns true if all commands in the transaction succeeded, false otherwise.
404 405 406 |
# File 'lib/familia/horreum/serialization.rb', line 404 def success @success end |
Instance Method Details
#successful? ⇒ Boolean Also known as: success?
Convenient method to check if the commit was successful.
437 438 439 |
# File 'lib/familia/horreum/serialization.rb', line 437 def successful? @success end |
#tuple ⇒ Array
Returns a tuple representing the result of the transaction.
430 431 432 |
# File 'lib/familia/horreum/serialization.rb', line 430 def tuple [successful?, results] end |