Class: Hive::Formatter

Inherits:
Object
  • Object
show all
Defined in:
lib/hive/formatter.rb

Class Method Summary collapse

Class Method Details

.reputation(raw) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/hive/formatter.rb', line 3

def self.reputation(raw)
  raw = raw.to_i
  neg = raw < 0
  level = Math.log10(raw.abs)
  level = [level - 9, 0].max
  level = (neg ? -1 : 1) * level
  level = (level * 9) + 25
  
  level.round(1)
end