lib/thread/promise.rb in thread-0.1.7 vs lib/thread/promise.rb in thread-0.2.0
- old
+ new
@@ -25,11 +25,11 @@
end
alias realized? delivered?
# Deliver a value.
- def deliver (value)
+ def deliver(value)
return self if delivered?
@mutex.synchronize {
@value = value
@@ -44,11 +44,11 @@
# Get the value that's been delivered, if none has been delivered yet the call
# will block until one is delivered.
#
# An optional timeout can be passed which will return nil if nothing has been
# delivered.
- def value (timeout = nil)
+ def value(timeout = nil)
return @value if delivered?
@mutex.synchronize {
cond.wait(@mutex, *timeout)
}
@@ -56,10 +56,10 @@
return @value if delivered?
end
alias ~ value
- private
+private
def cond?
instance_variable_defined? :@cond
end
def cond