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
25
26
27
|
# File 'lib/ehbrs_ruby_utils/circular_list_spreader/group_level.rb', line 25
def pop
children.values.max.pop
end
|
#pop_all ⇒ Object
29
30
31
32
33
|
# File 'lib/ehbrs_ruby_utils/circular_list_spreader/group_level.rb', line 29
def pop_all
r = []
r << pop while remaining?
r
end
|
#push(path, item) ⇒ Object
15
16
17
18
19
20
21
22
23
|
# File 'lib/ehbrs_ruby_utils/circular_list_spreader/group_level.rb', line 15
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
35
36
37
|
# File 'lib/ehbrs_ruby_utils/circular_list_spreader/group_level.rb', line 35
def remaining_i
children.values.inject(0) { |a, e| a + e.remaining_i }
end
|
#total_i ⇒ Object
39
40
41
|
# File 'lib/ehbrs_ruby_utils/circular_list_spreader/group_level.rb', line 39
def total_i
children.values.inject(0) { |a, e| a + e.total_i }
end
|