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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +24 -3
- data/inflation_db.gemspec +2 -2
- data/lib/inflation_db.rb +2 -2
- data/lib/inflation_db/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d34c711220fcff5221e26aeb7529ff53238cf742edd564cd316b9f0e359731be
|
4
|
+
data.tar.gz: 7a1ca8501ece3da384c42310327a3e5282264b888a240af5d8417bcf192aafe9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48035965f382f2cb64cbeaf1d27e950e598d6faf26fa1527da7622a9ab34a2fc3561fea1a0e0c38b81d4b59af81e7213fd4ab13182cb8e4e983f7aa8b1c5f0e1
|
7
|
+
data.tar.gz: 8fa98ed488df31c98b9100e7881f81bc65b76573b2c8bdebd1f32857c052d941fb355983e1a3232d49197b3297b30bd09af0b1c9f99e0e22478ada9531764d84
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -20,15 +20,36 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
23
|
-
|
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
|
-
|
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.
|
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
|
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(
|
391
|
-
amount_with_inflation = "%.2f" % (then_amount *
|
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
|
data/lib/inflation_db/version.rb
CHANGED
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.
|
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
|
101
|
-
|
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: []
|