Module: EhbrsRubyUtils::CircularListSpreader::BaseLevel
- Extended by:
- Comparable
- Included in:
- GroupLevel, ItemLevel
- Defined in:
- lib/ehbrs_ruby_utils/circular_list_spreader/base_level.rb
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #debugs ⇒ Object
- #remaining? ⇒ Boolean
- #remaining_f ⇒ Object
- #remaining_fs ⇒ Object
Instance Method Details
#<=>(other) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/ehbrs_ruby_utils/circular_list_spreader/base_level.rb', line 8 def <=>(other) s = remaining_f <=> other.remaining_f return s unless s.zero? s = total_i <=> other.total_i return s unless s.zero? label <=> other.label end |
#debugs ⇒ Object
30 31 32 |
# File 'lib/ehbrs_ruby_utils/circular_list_spreader/base_level.rb', line 30 def debugs [label, remaining_fs, total_i].join(' / ') end |
#remaining? ⇒ Boolean
18 19 20 |
# File 'lib/ehbrs_ruby_utils/circular_list_spreader/base_level.rb', line 18 def remaining? remaining_i.positive? end |
#remaining_f ⇒ Object
22 23 24 |
# File 'lib/ehbrs_ruby_utils/circular_list_spreader/base_level.rb', line 22 def remaining_f remaining_i.to_f / total_i end |
#remaining_fs ⇒ Object
26 27 28 |
# File 'lib/ehbrs_ruby_utils/circular_list_spreader/base_level.rb', line 26 def remaining_fs "#{(remaining_f * 1000).round / 10.0}%" end |