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, #deconstruct, #err_and?, #expect!, #map, #map_err, #ok_and?, #or, #or_else, #result?, #tap_err, #tap_ok, #to_json, #to_s, #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


342
343
344
# File 'lib/errgonomic/result.rb', line 342

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

Instance Attribute Details

#valueObject

Returns the value of attribute value.



335
336
337
# File 'lib/errgonomic/result.rb', line 335

def value
  @value
end

Instance Method Details

#err?Boolean

Err is always err

Examples:

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

Returns:

  • (Boolean)


350
351
352
# File 'lib/errgonomic/result.rb', line 350

def err?
  true
end

#ok?Boolean

Err is never ok

Examples:

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

Returns:

  • (Boolean)


358
359
360
# File 'lib/errgonomic/result.rb', line 358

def ok?
  false
end