Sha256: b0b92e1412b749c8aae24b36311c3e2644914138fcc4ffa2cf42e6a9bae808d6

Contents?: true

Size: 759 Bytes

Versions: 5

Compression:

Stored size: 759 Bytes

Contents

module Helper
  class EnergyBandCalculator
    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

    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
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
epb_view_models-2.0.5 lib/helper/energy_band_calculator.rb
epb_view_models-2.0.4 lib/helper/energy_band_calculator.rb
epb_view_models-2.0.3 lib/helper/energy_band_calculator.rb
epb_view_models-2.0.2 lib/helper/energy_band_calculator.rb
epb_view_models-2.0.1 lib/helper/energy_band_calculator.rb