Module: Timet::BlockCharHelper
- Defined in:
- lib/timet/block_char_helper.rb
Overview
The BlockCharHelper module provides a utility method for getting the block character based on a given value.
Constant Summary collapse
- CHAR_MAPPING =
Character mapping for different time ranges
{ 0..120 => '_', 121..450 => ' ', 451..900 => '▂', 901..1350 => '▃', 1351..1800 => '▄', 1801..2250 => '▅', 2251..2700 => '▆', 2701..3150 => '▇', 3151..3600 => '█' }.freeze
Class Method Summary collapse
-
.get_block_char(value) ⇒ String
Gets the block character for a given value.
Class Method Details
.get_block_char(value) ⇒ String
Gets the block character for a given value
26 27 28 29 30 31 |
# File 'lib/timet/block_char_helper.rb', line 26 def self.get_block_char(value) return ' ' unless value mapping = CHAR_MAPPING.find { |range, _| range.include?(value) } mapping ? mapping.last : ' ' end |