Class: Helper::EnergyBandCalculator
- Inherits:
-
Object
- Object
- Helper::EnergyBandCalculator
- Defined in:
- lib/helper/energy_band_calculator.rb
Class Method Summary collapse
Class Method Details
.commercial(number) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/helper/energy_band_calculator.rb', line 26 def self.commercial(number) if number.nil? return nil end case number when proc { |n| n <= -1 } "a+" when 0..25 "a" when 26..50 "b" when 51..75 "c" when 76..100 "d" when 101..125 "e" when 126..150 "f" else "g" end end |
.domestic(number) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/helper/energy_band_calculator.rb', line 3 def self.domestic(number) if number.nil? return nil end case number when proc { |n| n <= 20 } "g" when 21..38 "f" when 39..54 "e" when 55..68 "d" when 69..80 "c" when 81..91 "b" else "a" end end |