Class: Rake::Promise
- Inherits:
-
Object
- Object
- Rake::Promise
- Defined in:
- lib/rake/opt/current_invocation_chain/patches/rake/promise.rb
Defined Under Namespace
Classes: Fake
Instance Attribute Summary collapse
-
#invocation_chain ⇒ Object
Returns the value of attribute invocation_chain.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
Instance Method Summary collapse
- #__chore__ ⇒ Object
-
#chore(*args, &block) ⇒ Object
Properly set the parent thread.
-
#initialize(args, &block) ⇒ Promise
constructor
Create a promise to do the chore specified by the block.
Constructor Details
#initialize(args, &block) ⇒ Promise
Create a promise to do the chore specified by the block. Overrides by adding @parent
7 8 9 10 11 12 13 14 15 |
# File 'lib/rake/opt/current_invocation_chain/patches/rake/promise.rb', line 7 def initialize(args, &block) @mutex = Mutex.new @result = NOT_SET @error = NOT_SET @args = args @block = block @invocation_chain = nil @parent = Thread.current.promise end |
Instance Attribute Details
#invocation_chain ⇒ Object
Returns the value of attribute invocation_chain.
2 3 4 |
# File 'lib/rake/opt/current_invocation_chain/patches/rake/promise.rb', line 2 def invocation_chain @invocation_chain end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
3 4 5 |
# File 'lib/rake/opt/current_invocation_chain/patches/rake/promise.rb', line 3 def parent @parent end |
Instance Method Details
#__chore__ ⇒ Object
17 |
# File 'lib/rake/opt/current_invocation_chain/patches/rake/promise.rb', line 17 alias_method :__chore__, :chore |
#chore(*args, &block) ⇒ Object
Properly set the parent thread
20 21 22 23 24 25 |
# File 'lib/rake/opt/current_invocation_chain/patches/rake/promise.rb', line 20 def chore(*args, &block) old_promise = Thread.current.promise Thread.current.promise = self __chore__(*args, &block) Thread.current.promise = old_promise end |