Class: Monads::Success

Inherits:
Result
  • Object
show all
Defined in:
lib/ruby-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)


44
45
46
47
# File 'lib/ruby-monads/result.rb', line 44

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