Class: Async::Children
Overview
A list of children tasks.
Instance Attribute Summary
Attributes inherited from List
#The number of nodes in the list., #head, #size, #tail
Instance Method Summary collapse
-
#adjust_transient_count(transient) ⇒ Object
Adjust the number of transient children, assuming it has changed.
-
#finished? ⇒ Boolean
Whether all children are considered finished.
-
#initialize ⇒ Children
constructor
Create an empty list of children tasks.
-
#nil? ⇒ Boolean
Whether the children is empty, preserved for compatibility.
-
#transients? ⇒ Boolean
Some children may be marked as transient.
Methods inherited from List
#Points at the end of the list.=, #Points at the start of the list.=, #append, #each, #empty?, #first, #include?, #last, #prepend, #remove, #remove?, #shift, #stack, #to_a, #to_s
Constructor Details
#initialize ⇒ Children
Create an empty list of children tasks.
16 17 18 19 |
# File 'lib/async/node.rb', line 16 def initialize super @transient_count = 0 end |
Instance Method Details
#adjust_transient_count(transient) ⇒ Object
Adjust the number of transient children, assuming it has changed.
Despite being public, this is not intended to be called directly. It is used internally by Node#transient=.
42 43 44 45 46 47 48 |
# File 'lib/async/node.rb', line 42 def adjust_transient_count(transient) if transient @transient_count += 1 else @transient_count -= 1 end end |
#finished? ⇒ Boolean
Whether all children are considered finished. Ignores transient children.
28 29 30 |
# File 'lib/async/node.rb', line 28 def finished? @size == @transient_count end |
#nil? ⇒ Boolean
Whether the children is empty, preserved for compatibility.
33 34 35 |
# File 'lib/async/node.rb', line 33 def nil? empty? end |
#transients? ⇒ Boolean
Some children may be marked as transient. Transient children do not prevent the parent from finishing.
23 24 25 |
# File 'lib/async/node.rb', line 23 def transients? @transient_count > 0 end |