inflation_db 0.3.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ca2d1c9a4bdd789970f9f457c25737779633a25a99abfd69dab022985ce8df8c
4
- data.tar.gz: 7d16ef1839ed732423931a46af6d0cf63e9969997c739f7673a59950213ef1ee
3
+ metadata.gz: d34c711220fcff5221e26aeb7529ff53238cf742edd564cd316b9f0e359731be
4
+ data.tar.gz: 7a1ca8501ece3da384c42310327a3e5282264b888a240af5d8417bcf192aafe9
5
5
  SHA512:
6
- metadata.gz: 53522bfadf6160d7c706e9929f2a72539317ed4316650c7e62fef7f4ef42df8371854287ea9144efbee3876716ed345051707790fb9f114a047faf40bcd1c3ca
7
- data.tar.gz: f97245e521240f4e98ae4b0fdcdefd958f52f674042f77f76b7b1e1e594185deeec18095974adeb6f75cad6e9c4bab3e622ebd4dbd1c0df5e06444fdea51b6d2
6
+ metadata.gz: 48035965f382f2cb64cbeaf1d27e950e598d6faf26fa1527da7622a9ab34a2fc3561fea1a0e0c38b81d4b59af81e7213fd4ab13182cb8e4e983f7aa8b1c5f0e1
7
+ data.tar.gz: 8fa98ed488df31c98b9100e7881f81bc65b76573b2c8bdebd1f32857c052d941fb355983e1a3232d49197b3297b30bd09af0b1c9f99e0e22478ada9531764d84
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- inflation_db (0.3.0)
4
+ inflation_db (1.0.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -20,15 +20,36 @@ Or install it yourself as:
20
20
 
21
21
  ## Usage
22
22
 
23
- Call on the calculation method by adding this line to your code:
23
+ To calculate inflation on an amount from 1635-2018 to 2019, add this line to your code:
24
24
 
25
25
  ```calculate_inflation(year_of_original_amount, that_original_amount)```
26
26
 
27
27
  and the method will return a float rounded to two decimal places.
28
28
 
29
- ## Roadmap
29
+ To calculate inflation on an amount from 1635-2019 to any other year 1635, add this line to your code:
30
+
31
+ ```calculate_inflation(year_of_original_amount, that_original_amount, year_of_new_amount)```
32
+
33
+
34
+ Examples:
35
+
36
+ - to calculate inflation on $10 from 1776 to 2019, you can write
37
+
38
+ ```calculate_inflation(1776, 10)```
39
+
40
+ or
41
+
42
+ ```calculate_inflation(1776, 10, 2019)```
43
+
44
+ - to calculate inflation on $10 from 1776 to 1980, you would write
45
+
46
+ ```calculate_inflation(1776, 10, 1980)```
47
+
48
+ - to calculate what $100 in 2019 would have been worth in 1888, you would write
49
+
50
+ ```calculate_inflation(2019, 100, 1888)```
51
+
30
52
 
31
- Future releases will include the ability to calculate inflation from any year (post-1635) to any later year (not just 2019); and the ability to reverse the calculation, ie calculate what a 2019 dollar amount would have been worth in a previous year.
32
53
 
33
54
  ## Contributing
34
55
 
data/inflation_db.gemspec CHANGED
@@ -4,11 +4,11 @@ require "inflation_db/version"
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "inflation_db"
7
- spec.version = "0.3.0"
7
+ spec.version = "1.0.0"
8
8
  spec.authors = ["Dave Bushnell"]
9
9
  spec.email = ["dybushnell@gmail.com"]
10
10
 
11
- spec.summary = %q{A gem that calculates the inflation of a US dollar amount from any year from 1635 to the present.}
11
+ spec.summary = %q{A gem that calculates the inflation of a US dollar amount between any two years between 1635-2019.}
12
12
  spec.description = %q{It's 2019. Those other inflation-calculating gems haven't been updated since 2014.}
13
13
  spec.homepage = "https://github.com/dybushnell/inflation_db"
14
14
  spec.license = "MIT"
data/lib/inflation_db.rb CHANGED
@@ -387,7 +387,7 @@
387
387
  "2019" => 30.86060241,
388
388
  }
389
389
 
390
- def calculate_inflation(year, then_amount)
391
- amount_with_inflation = "%.2f" % (then_amount * 30.86060241 / @inflation_hash.fetch(year.to_s))
390
+ def calculate_inflation(from_year, then_amount, to_year = 2019)
391
+ amount_with_inflation = "%.2f" % (then_amount * @inflation_hash.fetch(to_year.to_s) / @inflation_hash.fetch(from_year.to_s))
392
392
  amount_with_inflation
393
393
  end
@@ -1,3 +1,3 @@
1
1
  module InflationDb
2
- VERSION = "0.3.0"
2
+ VERSION = "1.0.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inflation_db
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave Bushnell
@@ -97,6 +97,6 @@ requirements: []
97
97
  rubygems_version: 3.0.4
98
98
  signing_key:
99
99
  specification_version: 4
100
- summary: A gem that calculates the inflation of a US dollar amount from any year from
101
- 1635 to the present.
100
+ summary: A gem that calculates the inflation of a US dollar amount between any two
101
+ years between 1635-2019.
102
102
  test_files: []