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.



126
127
128
129
130
# File 'lib/async/node.rb', line 126

def initialize
  super
  
  @transient_count = 0
end

Instance Method Details

#delete(item) ⇒ Object



145
146
147
148
149
150
151
# File 'lib/async/node.rb', line 145

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

#finished?Boolean

Returns:

  • (Boolean)


153
154
155
# File 'lib/async/node.rb', line 153

def finished?
  @size == @transient_count
end

#insert(item) ⇒ Object



137
138
139
140
141
142
143
# File 'lib/async/node.rb', line 137

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

#transients?Boolean

Does this node have (direct) transient children?

Returns:

  • (Boolean)


133
134
135
# File 'lib/async/node.rb', line 133

def transients?
  @transient_count > 0
end