Class: Monads::Failure

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

Constant Summary

Constants inherited from Result

Result::FAILURE_TRIGGER

Class Method Summary collapse

Methods inherited from Result

#bind, unit, #unwrap

Methods included from Monad

#fmap, included, #initialize, #join, #method_missing

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Monads::Monad

Class Method Details

.new(value) ⇒ Object

Raises:

  • (TypeError)


47
48
49
50
# File 'lib/monads/result.rb', line 47

def self.new(value)
  raise TypeError, "value should not be of #{value.class}" unless value.is_a?(FAILURE_TRIGGER)
  super
end