class Concurrent::Maybe

def self.from(*args)

Raises:
  • (ArgumentError) - when no block given.

Returns:
  • (Maybe) - The newly created object.

Other tags:
    Yieldparam: args - Zero or more block arguments passed as

Other tags:
    Yield: - The block from which to create a new `Maybe`.

Parameters:
  • args (Array) -- Zero or more arguments to pass to the block.
    def self.from(*args)
      raise ArgumentError.new('no block given') unless block_given?
      begin
        value = yield(*args)
        return new(value, NONE)
      rescue => ex
        return new(NONE, ex)
      end
    end