Class: Async::Children

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

Instance Method Summary collapse

Constructor Details

#initializeChildren

Returns a new instance of Children.



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

def initialize
  super
  
  @transient_count = 0
end

Instance Method Details

#delete(item) ⇒ Object



141
142
143
144
145
146
147
# File 'lib/async/node.rb', line 141

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

#finished?Boolean

Returns:

  • (Boolean)


149
150
151
# File 'lib/async/node.rb', line 149

def finished?
  @size == @transient_count
end

#insert(item) ⇒ Object



133
134
135
136
137
138
139
# File 'lib/async/node.rb', line 133

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

#transients?Boolean

Does this node have (direct) transient children?

Returns:

  • (Boolean)


129
130
131
# File 'lib/async/node.rb', line 129

def transients?
  @transient_count > 0
end