class ReSorcery::Result::Err

Public Class Methods

new(err) click to toggle source
# File lib/re_sorcery/result/err.rb, line 6
def initialize(err)
  @err = err
end

Public Instance Methods

==(other) click to toggle source
# File lib/re_sorcery/result/err.rb, line 34
def ==(other)
  other.class == Err && other.instance_eval { @err } == @err
end
and_then() click to toggle source
# File lib/re_sorcery/result/err.rb, line 10
def and_then
  self
end
as_json(*) click to toggle source
# File lib/re_sorcery/result/err.rb, line 38
def as_json(*)
  {
    kind: :err,
    value: @err,
  }
end
assign(_name) click to toggle source
# File lib/re_sorcery/result/err.rb, line 26
def assign(_name)
  self
end
cata(ok:, err:) click to toggle source
# File lib/re_sorcery/result/err.rb, line 30
def cata(ok:, err:)
  err.call(@err)
end
map() click to toggle source
# File lib/re_sorcery/result/err.rb, line 14
def map
  self
end
map_error(&block) click to toggle source
# File lib/re_sorcery/result/err.rb, line 18
def map_error(&block)
  Err.new(block.call(@err))
end
or_else(&block) click to toggle source
# File lib/re_sorcery/result/err.rb, line 22
def or_else(&block)
  ArgCheck['block', block.call(@err), Ok, Err]
end