Class: Emu::Err

Inherits:
Object
  • Object
show all
Defined in:
lib/emu/result.rb

Instance Method Summary collapse

Constructor Details

#initialize(error) ⇒ Err

Returns a new instance of Err.



3
4
5
# File 'lib/emu/result.rb', line 3

def initialize(error)
  @error = error
end

Instance Method Details

#error?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/emu/result.rb', line 23

def error?
  true
end

#thenObject



11
12
13
# File 'lib/emu/result.rb', line 11

def then
  self
end

#to_sObject



7
8
9
# File 'lib/emu/result.rb', line 7

def to_s
  "Err(#{@error})"
end

#unwrapObject



15
16
17
# File 'lib/emu/result.rb', line 15

def unwrap
  raise "can't unwrap Err(#{@error.inspect})"
end

#unwrap_errObject



19
20
21
# File 'lib/emu/result.rb', line 19

def unwrap_err
  @error
end