Module: Kind::Either

Extended by:
Either
Included in:
Either
Defined in:
lib/kind/either.rb

Defined Under Namespace

Modules: Methods Classes: Left, Monad, Right

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.fromObject



20
21
22
23
24
25
26
# File 'lib/kind/either.rb', line 20

def self.from
  result = yield

  Either::Monad === result ? result : Either::Right[result]
rescue StandardError => e
  Either::Left[e]
end

Instance Method Details

#new(value) ⇒ Object Also known as: []



14
15
16
# File 'lib/kind/either.rb', line 14

def new(value)
  Right[value]
end