class Rbfs::Future
Public Class Methods
new(&callable)
click to toggle source
# File lib/rbfs/futures.rb, line 3 def initialize(&callable) @thread ||= ::Thread.new { callable.call } end
Public Instance Methods
inspect()
click to toggle source
# File lib/rbfs/futures.rb, line 11 def inspect if @thread.alive? "#<Future running>" else value.inspect end end
method_missing(method, *args)
click to toggle source
# File lib/rbfs/futures.rb, line 19 def method_missing(method, *args) value.send(method, *args) end
respond_to_missing?(method, include_private = false)
click to toggle source
# File lib/rbfs/futures.rb, line 23 def respond_to_missing?(method, include_private = false) value.respond_to?(method, include_private) end
value()
click to toggle source
# File lib/rbfs/futures.rb, line 7 def value @thread.value end