Class: Try::Failure

Inherits:
Trither::Box show all
Includes:
Trither::BasicTypes
Defined in:
lib/trither/try.rb,
lib/trither/try.rb

Constant Summary

Constants included from Trither::BasicTypes

Trither::BasicTypes::C, Trither::BasicTypes::Func0, Trither::BasicTypes::Func1, Trither::BasicTypes::Predicate

Constants inherited from Trither::Box

Trither::Box::C

Instance Method Summary collapse

Methods inherited from Trither::Box

#==, #initialize

Constructor Details

This class inherits a constructor from Trither::Box

Instance Method Details

#fail_mapObject



48
49
50
# File 'lib/trither/try.rb', line 48

def fail_map
  Failure.new yield(@value)
end

#failure?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/trither/try.rb', line 28

def failure?
  true
end

#filterObject



33
34
35
# File 'lib/trither/try.rb', line 33

def filter
  self
end

#flat_mapObject



38
39
40
# File 'lib/trither/try.rb', line 38

def flat_map
  self
end

#get_or_else {|@value| ... } ⇒ Object

Yields:

  • (@value)


58
59
60
# File 'lib/trither/try.rb', line 58

def get_or_else
  yield @value
end

#mapObject



43
44
45
# File 'lib/trither/try.rb', line 43

def map
  self
end

#or_else {|@value| ... } ⇒ Object

Yields:

  • (@value)


53
54
55
# File 'lib/trither/try.rb', line 53

def or_else
  yield @value
end