Class: RothIRA
- Inherits:
-
Object
- Object
- RothIRA
- Defined in:
- lib/roth_ira.rb,
lib/roth_ira/version.rb
Constant Summary collapse
- VERSION =
'1.2.1'
Instance Attribute Summary collapse
-
#age ⇒ Object
readonly
Returns the value of attribute age.
-
#agi ⇒ Object
readonly
Returns the value of attribute agi.
-
#filing_status ⇒ Object
readonly
Returns the value of attribute filing_status.
-
#limits ⇒ Object
readonly
Returns the value of attribute limits.
-
#spouse_age ⇒ Object
readonly
Returns the value of attribute spouse_age.
-
#year ⇒ Object
readonly
Returns the value of attribute year.
Instance Method Summary collapse
- #calculate(agi, filing_status, *ages) ⇒ Object
-
#initialize(year) ⇒ RothIRA
constructor
A new instance of RothIRA.
Constructor Details
#initialize(year) ⇒ RothIRA
Returns a new instance of RothIRA.
6 7 8 9 10 |
# File 'lib/roth_ira.rb', line 6 def initialize(year) raise(ArgumentError, "Invalid Tax Year #{year}") unless year.between?(2015, 2018) @year = year @limits = YAML.load(File.read(__dir__ + "/limits.yaml"))[year] end |
Instance Attribute Details
#age ⇒ Object (readonly)
Returns the value of attribute age.
4 5 6 |
# File 'lib/roth_ira.rb', line 4 def age @age end |
#agi ⇒ Object (readonly)
Returns the value of attribute agi.
4 5 6 |
# File 'lib/roth_ira.rb', line 4 def agi @agi end |
#filing_status ⇒ Object (readonly)
Returns the value of attribute filing_status.
4 5 6 |
# File 'lib/roth_ira.rb', line 4 def filing_status @filing_status end |
#limits ⇒ Object (readonly)
Returns the value of attribute limits.
4 5 6 |
# File 'lib/roth_ira.rb', line 4 def limits @limits end |
#spouse_age ⇒ Object (readonly)
Returns the value of attribute spouse_age.
4 5 6 |
# File 'lib/roth_ira.rb', line 4 def spouse_age @spouse_age end |
#year ⇒ Object (readonly)
Returns the value of attribute year.
4 5 6 |
# File 'lib/roth_ira.rb', line 4 def year @year end |
Instance Method Details
#calculate(agi, filing_status, *ages) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/roth_ira.rb', line 12 def calculate(agi, filing_status, *ages) @agi = agi @filing_status = filing_status @age = ages.first @spouse_age = ages.size == 2 ? ages.last : 0 calculate_limit end |