class Mon::Monad::FutureComplete

FutureComplete represents a finalized value.

Public Class Methods

[](value) click to toggle source

You should probably be using Future instead.

# File lib/monads/future.rb, line 126
def self::[](value)
  self::new(value)
end

Protected Class Methods

new(value) click to toggle source
# File lib/monads/future.rb, line 121
def initialize(value)
  @value = value
end

Public Instance Methods

bind(&fun) click to toggle source

Asyrchronously apply fun to the value wrapped by this FutureComplete. Returns a FuturePromise.

# File lib/monads/future.rb, line 131
def bind &fun
  FuturePromise::perform(fun, [@value])
end
pending?() click to toggle source
# File lib/monads/future.rb, line 135
def pending?
  false
end
to_s() click to toggle source
# File lib/monads/future.rb, line 143
def to_s
  "FutureComplete[#{ @value }]"
end
unwrap() click to toggle source
# File lib/monads/future.rb, line 139
def unwrap
  @value
end