Class: Async::Children

Inherits:
List
  • Object
show all
Defined in:
lib/async/node.rb

Overview

A list of children tasks.

Instance Method Summary collapse

Constructor Details

#initializeChildren

Returns a new instance of Children.



111
112
113
114
115
# File 'lib/async/node.rb', line 111

def initialize
  super
  
  @transient_count = 0
end

Instance Method Details

#delete(item) ⇒ Object



130
131
132
133
134
135
136
# File 'lib/async/node.rb', line 130

def delete(item)
  if item.transient?
    @transient_count -= 1
  end
  
  super
end

#finished?Boolean

Returns:

  • (Boolean)


138
139
140
# File 'lib/async/node.rb', line 138

def finished?
  @size == @transient_count
end

#insert(item) ⇒ Object



122
123
124
125
126
127
128
# File 'lib/async/node.rb', line 122

def insert(item)
  if item.transient?
    @transient_count += 1
  end
  
  super
end

#transients?Boolean

Does this node have (direct) transient children?

Returns:

  • (Boolean)


118
119
120
# File 'lib/async/node.rb', line 118

def transients?
  @transient_count > 0
end