class PavementConditionIndex::PCI
Attributes
score[R]
Public Class Methods
new(score:nil)
click to toggle source
# File lib/pavement_condition_index/pci.rb, line 6 def initialize(score:nil) @score = score end
Public Instance Methods
color()
click to toggle source
# File lib/pavement_condition_index/pci.rb, line 37 def color lookup[:color] end
lookup()
click to toggle source
# File lib/pavement_condition_index/pci.rb, line 10 def lookup @lookup ||= begin case @score.to_i when 85..100 {rating: 'Good', color: '0f7d1d'} when 70..85 {rating: 'Satisfactory', color: '1ec734'} when 55..70 {rating: 'Fair', color: 'fefb4a'} when 40..55 {rating: 'Poor', color: 'fc2e1f'} when 25..40 {rating: 'Very Poor', color: 'a81a10'} when 10..25 {rating: 'Serious', color: '690d07'} when 0..10 {rating: 'Failed', color: '979797'} else {rating: 'ERROR', color: '000000'} end end end
rating()
click to toggle source
# File lib/pavement_condition_index/pci.rb, line 33 def rating lookup[:rating] end