Module: Kleisli::Conversions::ToValidation
- Defined in:
- lib/kleisli/conversions.rb
Constant Summary collapse
- GetRight =
-> x { x.right }
- GetLeft =
-> x { x.left }
- GetVal =
-> x { x.value }
- GetEx =
-> x { x.exception. }
Class Method Summary collapse
Class Method Details
.enrich(o_self, sc, fc, sp, fp) ⇒ Object
58 59 60 61 62 63 64 65 66 67 |
# File 'lib/kleisli/conversions.rb', line 58 def self.enrich(o_self, sc, fc, sp , fp) o_self.send(:define_method, :to_validation) do case when is_a?(sc) Success(sp.call(self)) when is_a?(fc) Failure(fp.call(self)) end end end |