inflation-calc 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/inflation-calc.rb +8 -9
- metadata +34 -2
data/lib/inflation-calc.rb
CHANGED
@@ -2,7 +2,7 @@ require 'bigdecimal'
|
|
2
2
|
require 'bigdecimal/util'
|
3
3
|
|
4
4
|
class InflationCalc
|
5
|
-
#
|
5
|
+
#data from the Bureau of Labor Statistics
|
6
6
|
def cpi
|
7
7
|
cpi = {1913 => 9.9,
|
8
8
|
1914 => 10,
|
@@ -113,15 +113,14 @@ class InflationCalc
|
|
113
113
|
amount = gets.chomp
|
114
114
|
print "Pick a year from 1913 to 2013: "
|
115
115
|
year = gets.chomp.to_i
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
break
|
123
|
-
end
|
116
|
+
while true
|
117
|
+
if year < 1913 || year > 2013
|
118
|
+
print "The year must be from 1913 to 2013. Enter year: "
|
119
|
+
year = gets.chomp.to_i
|
120
|
+
else
|
121
|
+
break
|
124
122
|
end
|
123
|
+
end
|
125
124
|
a = amount.to_d * (cpi[2014].to_d / cpi[year].to_d)
|
126
125
|
puts "$#{amount} in #{year} has the same buying power as $#{a.to_f.round(2)} in 2014."
|
127
126
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inflation-calc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,39 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
date: 2014-03-13 00:00:00.000000000 Z
|
13
|
-
dependencies:
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bigdecimal
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: bigdecimal/util
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
14
46
|
description: Enter an amount, pick a year from 1913 to 2013 and learn the equivalent
|
15
47
|
buying power in 2014.
|
16
48
|
email: armiemargaretlee@yahoo.com
|