Module: NotMonads::Do::MixinInstance

Defined in:
lib/not_monads/do.rb

Instance Method Summary collapse

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

Raises:



24
25
26
# File 'lib/not_monads/do.rb', line 24

def halt(result)
  raise Halt, result
end

#Success(value = nil) ⇒ Object

rubocop:disable Naming/MethodName



9
10
11
# File 'lib/not_monads/do.rb', line 9

def Success(value = nil)
  NotMonads::Result::Success.new(value)
end