Module: Ytry
- Defined in:
- lib/ytry.rb,
lib/ytry/version.rb
Defined Under Namespace
Modules: Try Classes: Failure, Success
Constant Summary collapse
- VERSION =
"2.0.0"
Instance Method Summary collapse
Instance Method Details
#Try ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/ytry.rb', line 4 def Try raise ArgumentError, 'missing block' unless block_given? begin Success.new(yield) rescue StandardError => e Failure.new(e) end end |