class Roby::Promise::Null
A null object for {Promise}
Public Class Methods
new(value = nil)
click to toggle source
# File lib/roby/promise.rb, line 299 def initialize(value = nil) @creation_time = Time.now @value = value end
Public Instance Methods
add_observer(&block)
click to toggle source
# File lib/roby/promise.rb, line 326 def add_observer(&block) block.call(@creation_time, value, nil) end
before(*)
click to toggle source
# File lib/roby/promise.rb, line 307 def before(*); raise NullPromise, "attempting to add a step on a null promise" end
complete?()
click to toggle source
# File lib/roby/promise.rb, line 316 def complete?; true end
empty?()
click to toggle source
# File lib/roby/promise.rb, line 305 def empty?; true end
execute()
click to toggle source
# File lib/roby/promise.rb, line 313 def execute; self end
fail(*)
click to toggle source
# File lib/roby/promise.rb, line 312 def fail(*); raise NullPromise, "a null promise cannot fail" end
fulfilled?()
click to toggle source
# File lib/roby/promise.rb, line 317 def fulfilled?; true end
null?()
click to toggle source
# File lib/roby/promise.rb, line 304 def null?; true end
on_error(*)
click to toggle source
# File lib/roby/promise.rb, line 309 def on_error(*); raise NullPromise, "attempting to add a step on a null promise" end
on_success(*)
click to toggle source
# File lib/roby/promise.rb, line 308 def on_success(*); raise NullPromise, "attempting to add a step on a null promise" end
pending?()
click to toggle source
# File lib/roby/promise.rb, line 315 def pending?; false end
reason()
click to toggle source
# File lib/roby/promise.rb, line 323 def reason; end
rejected?()
click to toggle source
# File lib/roby/promise.rb, line 318 def rejected?; false end
state()
click to toggle source
# File lib/roby/promise.rb, line 324 def state; :fulfilled end
then(*)
click to toggle source
# File lib/roby/promise.rb, line 310 def then(*); raise NullPromise, "attempting to add a step on a null promise" end
unscheduled?()
click to toggle source
# File lib/roby/promise.rb, line 314 def unscheduled?; false end
value(*)
click to toggle source
# File lib/roby/promise.rb, line 321 def value(*); @value end
value!(*)
click to toggle source
# File lib/roby/promise.rb, line 322 def value!(*); @value end
wait()
click to toggle source
# File lib/roby/promise.rb, line 319 def wait; end