Created
November 1, 2014 18:33
-
-
Save ryanstout/094bc34853527a68169e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'promise' | |
class PromiseRunner | |
attr_reader :promise | |
def initialize | |
@promise = Promise.new | |
end | |
def test | |
@promise = @promise.then do |v| | |
puts "Original #{v.inspect}" | |
return 10 | |
end | |
end | |
def second | |
@promise.then do |v| | |
puts "GOT: #{v}" | |
end | |
end | |
end | |
pr = PromiseRunner.new | |
pr.test | |
pr.second | |
pr.promise.resolve(20) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment