Class: Opto::Task::Result
- Inherits:
-
Object
- Object
- Opto::Task::Result
- Defined in:
- lib/opto/task/result.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#outcome ⇒ Object
Returns the value of attribute outcome.
-
#task ⇒ Object
readonly
Returns the value of attribute task.
Instance Method Summary collapse
- #failure? ⇒ Boolean
-
#initialize(task = nil) ⇒ Result
constructor
A new instance of Result.
- #success? ⇒ Boolean
Constructor Details
#initialize(task = nil) ⇒ Result
Returns a new instance of Result.
7 8 9 10 |
# File 'lib/opto/task/result.rb', line 7 def initialize(task = nil) @task = task @errors = {} end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
4 5 6 |
# File 'lib/opto/task/result.rb', line 4 def errors @errors end |
#outcome ⇒ Object
Returns the value of attribute outcome.
5 6 7 |
# File 'lib/opto/task/result.rb', line 5 def outcome @outcome end |
#task ⇒ Object (readonly)
Returns the value of attribute task.
4 5 6 |
# File 'lib/opto/task/result.rb', line 4 def task @task end |
Instance Method Details
#failure? ⇒ Boolean
16 17 18 |
# File 'lib/opto/task/result.rb', line 16 def failure? !success? end |
#success? ⇒ Boolean
12 13 14 |
# File 'lib/opto/task/result.rb', line 12 def success? errors.empty? end |