Module: BestBoy::BestBoyViewHelper

Defined in:
app/helpers/best_boy/best_boy_view_helper.rb

Instance Method Summary collapse

Instance Method Details

#relative_occurrences(hash, key) ⇒ Object



4
5
6
7
8
# File 'app/helpers/best_boy/best_boy_view_helper.rb', line 4

def relative_occurrences(hash, key)
  val = hash[key].to_f
  val = val / hash[:overall].to_f * 100 if hash[:overall].to_i > 0
  number_to_percentage(val, precision: 2)
end