Class: EhbrsRubyUtils::CircularListSpreader::GroupLevel
- Inherits:
-
Object
- Object
- EhbrsRubyUtils::CircularListSpreader::GroupLevel
show all
- Includes:
- BaseLevel
- Defined in:
- lib/ehbrs_ruby_utils/circular_list_spreader/group_level.rb
Instance Method Summary
collapse
Methods included from BaseLevel
#<=>, #debugs, #remaining?, #remaining_f, #remaining_fs
Instance Method Details
#pop ⇒ Object
22
23
24
|
# File 'lib/ehbrs_ruby_utils/circular_list_spreader/group_level.rb', line 22
def pop
children.values.max.pop
end
|
#pop_all ⇒ Object
26
27
28
29
30
|
# File 'lib/ehbrs_ruby_utils/circular_list_spreader/group_level.rb', line 26
def pop_all
r = []
r << pop while remaining?
r
end
|
#push(path, item) ⇒ Object
12
13
14
15
16
17
18
19
20
|
# File 'lib/ehbrs_ruby_utils/circular_list_spreader/group_level.rb', line 12
def push(path, item)
child_path = path.dup
current = child_path.shift
if child_path.any?
push_group_level(current, child_path, item)
else
push_item_level(current, item)
end
end
|
#remaining_i ⇒ Object
32
33
34
|
# File 'lib/ehbrs_ruby_utils/circular_list_spreader/group_level.rb', line 32
def remaining_i
children.values.inject(0) { |a, e| a + e.remaining_i }
end
|
#total_i ⇒ Object
36
37
38
|
# File 'lib/ehbrs_ruby_utils/circular_list_spreader/group_level.rb', line 36
def total_i
children.values.inject(0) { |a, e| a + e.total_i }
end
|