Sha256: a7a1926897a98d4671c913d1e31320232272f8859fdd7f454627a1ceab5346c6
Contents?: true
Size: 1.1 KB
Versions: 10
Compression:
Stored size: 1.1 KB
Contents
module Fear class Right include Either include RightBiased::Right # @return [true] def right? true end alias success? right? # @return [false] def left? false end alias failure? left? # @param default [Proc, any] # @return [Either] def select_or_else(default) if yield(value) self else Left.new(Utils.return_or_call_proc(default)) end end # @return [Either] def select if yield(value) self else Left.new(value) end end # @return [Either] def reject if yield(value) Left.new(value) else self end end # @return [Left] value in `Left` def swap Left.new(value) end # @param reduce_right [Proc] # @return [any] def reduce(_, reduce_right) reduce_right.call(value) end # @return [Either] # @raise [TypeError] def join_right value.tap do |v| Utils.assert_type!(v, Either) end end # @return [self] def join_left self end end end
Version data entries
10 entries across 10 versions & 1 rubygems