Class: FortuneTeller::InflatingInt
- Inherits:
-
Object
- Object
- FortuneTeller::InflatingInt
- Defined in:
- lib/fortuneteller/inflating_int.rb
Overview
An integer that inflates with time
Instance Method Summary collapse
-
#initialize(int:, start_date:) ⇒ InflatingInt
constructor
A new instance of InflatingInt.
- #on(date) ⇒ Object
Constructor Details
#initialize(int:, start_date:) ⇒ InflatingInt
Returns a new instance of InflatingInt.
4 5 6 7 |
# File 'lib/fortuneteller/inflating_int.rb', line 4 def initialize(int:, start_date:) @int = int @start_date = start_date end |
Instance Method Details
#on(date) ⇒ Object
9 10 11 |
# File 'lib/fortuneteller/inflating_int.rb', line 9 def on(date) (@int * 1.02**(date.year - @start_date.year)).floor end |