Module: Kind::Result

Extended by:
Result
Included in:
Result
Defined in:
lib/kind/result.rb

Defined Under Namespace

Modules: Abstract, Methods Classes: Failure, Monad, Success

Class Method Summary collapse

Class Method Details

.fromObject



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

def self.from
  result = yield

  Result::Monad === result ? result : Result::Success[result]
rescue StandardError => e
  Result::Failure[:exception, e]
end