Class: Try::Success
Constant Summary
Trither::BasicTypes::C, Trither::BasicTypes::Func0, Trither::BasicTypes::Func1, Trither::BasicTypes::Predicate
Constants inherited
from Trither::Box
Trither::Box::C
Instance Method Summary
collapse
#==, #initialize
Constructor Details
This class inherits a constructor from Trither::Box
Instance Method Details
#fail_map ⇒ Object
87
88
89
|
# File 'lib/trither/try.rb', line 87
def fail_map
self
end
|
#failure? ⇒ Boolean
67
68
69
|
# File 'lib/trither/try.rb', line 67
def failure?
false
end
|
#filter ⇒ Object
72
73
74
|
# File 'lib/trither/try.rb', line 72
def filter
yield(@value) ? self : Failure.new(Option::None)
end
|
#flat_map {|@value| ... } ⇒ Object
77
78
79
|
# File 'lib/trither/try.rb', line 77
def flat_map
yield @value
end
|
#get_or_else ⇒ Object
97
98
99
|
# File 'lib/trither/try.rb', line 97
def get_or_else
@value
end
|
#map ⇒ Object
82
83
84
|
# File 'lib/trither/try.rb', line 82
def map
Success.new yield(@value)
end
|
#or_else ⇒ Object
92
93
94
|
# File 'lib/trither/try.rb', line 92
def or_else
self
end
|