Class: Decay
- Inherits:
-
Object
- Object
- Decay
- Defined in:
- lib/ip-world-map/decay.rb
Overview
Instance Method Summary collapse
-
#initialize(initial_value, lifetime) ⇒ Decay
constructor
A new instance of Decay.
- #value(time) ⇒ Object
Constructor Details
#initialize(initial_value, lifetime) ⇒ Decay
Returns a new instance of Decay.
3 4 5 6 |
# File 'lib/ip-world-map/decay.rb', line 3 def initialize initial_value, lifetime @initial_value = initial_value.to_f @lifetime = lifetime.to_f end |
Instance Method Details
#value(time) ⇒ Object
8 9 10 |
# File 'lib/ip-world-map/decay.rb', line 8 def value time @initial_value * Math::exp(-time / @lifetime) end |