Module: Fear::Try::Mixin
- Included in:
- Mixin
- Defined in:
- lib/fear/try.rb
Overview
Include this mixin to access convenient factory methods.
Instance Method Summary collapse
- #Failure(exception) ⇒ Failure
- #Success(value) ⇒ Success
-
#Try(&block) ⇒ Try
Constructs a
Tryusing the block.
Instance Method Details
#Failure(exception) ⇒ Failure
307 308 309 |
# File 'lib/fear/try.rb', line 307 def Failure(exception) Fear.failure(exception) end |
#Success(value) ⇒ Success
314 315 316 |
# File 'lib/fear/try.rb', line 314 def Success(value) Fear.success(value) end |
#Try(&block) ⇒ Try
Constructs a Try using the block. This method ensures any non-fatal exception is caught and a Failure object is returned.
300 301 302 |
# File 'lib/fear/try.rb', line 300 def Try(&block) Fear.try(&block) end |