module ReSorcery::Helpers

Private Instance Methods

err(e) click to toggle source
# File lib/re_sorcery/helpers.rb, line 25
def err(e)
  Result::Err.new(e)
end
just(value) click to toggle source
# File lib/re_sorcery/helpers.rb, line 5
def just(value)
  Maybe::Just.new(value)
end
nillable(value) click to toggle source

Wrap a possibly-nil value in a ‘Maybe`

@param value The value to wrap in a ‘Maybe`. @return [Maybe]

# File lib/re_sorcery/helpers.rb, line 17
def nillable(value)
  value.nil? ? nothing : just(value)
end
nothing() click to toggle source
# File lib/re_sorcery/helpers.rb, line 9
def nothing
  Maybe::Nothing.new
end
ok(value) click to toggle source
# File lib/re_sorcery/helpers.rb, line 21
def ok(value)
  Result::Ok.new(value)
end