Class: Errgonomic::Result::Err

Inherits:
Any show all
Defined in:
lib/errgonomic/result.rb

Defined Under Namespace

Classes: Arbitrary

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Any

#==, #and, #and_then, #err_and?, #expect!, #ok_and?, #or, #or_else, #result?, #unwrap!, #unwrap_err!, #unwrap_or, #unwrap_or_else

Constructor Details

#initialize(value = Arbitrary) ⇒ Err

Err may be constructed without a value, if you want.

Examples:

Err(:y).value # => :y
Err().value # => Arbitrary


255
256
257
# File 'lib/errgonomic/result.rb', line 255

def initialize(value = Arbitrary)
  super(value)
end

Instance Attribute Details

#valueObject

Returns the value of attribute value.



248
249
250
# File 'lib/errgonomic/result.rb', line 248

def value
  @value
end

Instance Method Details

#err?Boolean

Err is always err

Examples:

Err(:z).err? # => true

Returns:

  • (Boolean)


263
264
265
# File 'lib/errgonomic/result.rb', line 263

def err?
  true
end

#ok?Boolean

Err is never ok

Examples:

Err(:A).ok? # => false

Returns:

  • (Boolean)


271
272
273
# File 'lib/errgonomic/result.rb', line 271

def ok?
  false
end