Class Numeric
In: lib/utilities.rb
Parent: Object

Methods

Public Instance methods

[Source]

    # File lib/utilities.rb, line 33
33:   def as_percentage(total, multiplier = 100)
34:     total.zero? ? 0.0 : multiplier * (self / total.to_f)
35:   end

[Source]

    # File lib/utilities.rb, line 28
28:   def relative(from, to = nil)
29:     res = from.range > 0 ? (from.max - self) / from.range.to_f : 0
30:     to.nil? ? res : res * to.range + to.min
31:   end

Helioid