Module: ResultMethods
- Included in:
- Resultt::Error, Resultt::Success
- Defined in:
- lib/resultt/result_methods.rb
Instance Method Summary collapse
Instance Method Details
#map ⇒ Object
2 3 4 5 6 7 8 |
# File 'lib/resultt/result_methods.rb', line 2 def map return self if self.class == Resultt::Error Resultt::Success.new yield value rescue StandardError => e Resultt::Error.new(e) end |
#map_error ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/resultt/result_methods.rb', line 10 def map_error return self if self.class == Resultt::Success Resultt::Error.new yield error rescue StandardError => e Resultt::Error.new(e) end |