Class: Funcify::Cond
- Inherits:
-
Object
- Object
- Funcify::Cond
- Defined in:
- lib/funcify/cond.rb
Class Method Summary collapse
-
.either ⇒ Object
The little Either Cond returns either the result of fn_ok || fn_fail by applying the value to test <t>.
Class Method Details
.either ⇒ Object
The little Either Cond returns either the result of fn_ok || fn_fail by applying the value to test <t>. > either.(Monad.maybe_value_ok, identity, Monad.maybe_value).(Success(1)) => 1
10 11 12 |
# File 'lib/funcify/cond.rb', line 10 def either -> test, fn_ok, fn_fail, value { test.(value) ? fn_ok.(value) : fn_fail.(value) }.curry end |