Module: NotMonads::Do::MixinInstance
- Defined in:
- lib/not_monads/do.rb
Instance Method Summary collapse
-
#do_something(result) ⇒ Object
rubocop:enable Naming/MethodName.
- #Failure(value = nil) ⇒ Object
- #halt(result) ⇒ Object
-
#Success(value = nil) ⇒ Object
rubocop:disable Naming/MethodName.
Instance Method Details
#do_something(result) ⇒ Object
rubocop:enable Naming/MethodName
18 19 20 21 22 |
# File 'lib/not_monads/do.rb', line 18 def do_something(result) return result.success if result.success? halt(result) end |
#Failure(value = nil) ⇒ Object
13 14 15 |
# File 'lib/not_monads/do.rb', line 13 def Failure(value = nil) NotMonads::Result::Failure.new(value) end |
#halt(result) ⇒ Object
24 25 26 |
# File 'lib/not_monads/do.rb', line 24 def halt(result) raise Halt, result end |