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!, #map, #ok_and?, #or, #or_else, #result?, #tap_err, #tap_ok, #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


290
291
292
# File 'lib/errgonomic/result.rb', line 290

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

Instance Attribute Details

#valueObject

Returns the value of attribute value.



283
284
285
# File 'lib/errgonomic/result.rb', line 283

def value
  @value
end

Instance Method Details

#err?Boolean

Err is always err

Examples:

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

Returns:

  • (Boolean)


298
299
300
# File 'lib/errgonomic/result.rb', line 298

def err?
  true
end

#ok?Boolean

Err is never ok

Examples:

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

Returns:

  • (Boolean)


306
307
308
# File 'lib/errgonomic/result.rb', line 306

def ok?
  false
end