Class: Writ::Outcome
- Inherits:
-
Object
- Object
- Writ::Outcome
- Defined in:
- lib/writ.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Public: Get the errors Hash generated by running Writ.run.
-
#input ⇒ Object
readonly
Public: Get the Writ object, with the user input as accessors.
-
#value ⇒ Object
readonly
Public: Get the return value of your Writ.
Instance Method Summary collapse
-
#initialize(value, writ) ⇒ Outcome
constructor
Public: Initialize the outcome.
-
#success? ⇒ Boolean
Public: Whether the Writ performed successfully or not (i.e. no errors are present.).
Constructor Details
#initialize(value, writ) ⇒ Outcome
Public: Initialize the outcome.
value - The return value from Writ.run writ - The Writ instance.
44 45 46 47 48 |
# File 'lib/writ.rb', line 44 def initialize(value, writ) @value = value @input = writ @errors = writ.errors end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Public: Get the errors Hash generated by running Writ.run. This will be an empty Hash if no errors were returned.
38 39 40 |
# File 'lib/writ.rb', line 38 def errors @errors end |
#input ⇒ Object (readonly)
Public: Get the Writ object, with the user input as accessors.
34 35 36 |
# File 'lib/writ.rb', line 34 def input @input end |
#value ⇒ Object (readonly)
Public: Get the return value of your Writ.
31 32 33 |
# File 'lib/writ.rb', line 31 def value @value end |
Instance Method Details
#success? ⇒ Boolean
Public: Whether the Writ performed successfully or not (i.e. no errors are present.)
Returns Boolean.
54 55 56 |
# File 'lib/writ.rb', line 54 def success? errors.empty? end |