Class: Decay

Inherits:
Object
  • Object
show all
Defined in:
lib/ip-world-map/decay.rb

Overview

Instance Method Summary collapse

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