Class: AmazingActivist::Outcome::Success
- Inherits:
-
Object
- Object
- AmazingActivist::Outcome::Success
- Defined in:
- lib/amazing_activist/outcome/success.rb
Instance Attribute Summary collapse
- #activity ⇒ AmazingActivist::Base readonly
Instance Method Summary collapse
- #deconstruct ⇒ Array
- #deconstruct_keys(_) ⇒ Hash
- #failure? ⇒ false
-
#initialize(value, activity:) ⇒ Success
constructor
A new instance of Success.
- #success? ⇒ true
- #unwrap! ⇒ Object
- #value_or ⇒ Object
Constructor Details
#initialize(value, activity:) ⇒ Success
Returns a new instance of Success.
11 12 13 14 |
# File 'lib/amazing_activist/outcome/success.rb', line 11 def initialize(value, activity:) @value = value @activity = activity end |
Instance Attribute Details
#activity ⇒ AmazingActivist::Base (readonly)
7 8 9 |
# File 'lib/amazing_activist/outcome/success.rb', line 7 def activity @activity end |
Instance Method Details
#deconstruct ⇒ Array
28 29 30 |
# File 'lib/amazing_activist/outcome/success.rb', line 28 def deconstruct [:success, @value, @activity] end |
#deconstruct_keys(_) ⇒ Hash
34 35 36 |
# File 'lib/amazing_activist/outcome/success.rb', line 34 def deconstruct_keys(_) { success: @value, activity: @activity } end |
#failure? ⇒ false
22 23 24 |
# File 'lib/amazing_activist/outcome/success.rb', line 22 def failure? false end |
#success? ⇒ true
17 18 19 |
# File 'lib/amazing_activist/outcome/success.rb', line 17 def success? true end |
#unwrap! ⇒ Object
44 45 46 |
# File 'lib/amazing_activist/outcome/success.rb', line 44 def unwrap! @value end |
#value_or ⇒ Object
39 40 41 |
# File 'lib/amazing_activist/outcome/success.rb', line 39 def value_or @value end |