Skip to content

Instantly share code, notes, and snippets.

@colmjude
Created February 12, 2015 14:12
Show Gist options
  • Save colmjude/a01c9eeda37f28bf226e to your computer and use it in GitHub Desktop.
Save colmjude/a01c9eeda37f28bf226e to your computer and use it in GitHub Desktop.
RIO Calc script
module PensionsCalculator
class RioCalc
def initialize(potsize)
@potsize = potsize
end
def run_calc()
person = PensionsCalculator::Person.new;
person.salary = 50000;
contributions = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]
terms = [1,3,5,10,15,20,30]
contributions.each { |cont|
print "#{@potsize}, #{cont},"
terms.each { |term|
pot = PensionsCalculator::Pot.new(current_pots: PensionsCalculator::CurrentPots.new(pot_1: @potsize), employee_contribution: PensionsCalculator::Contribution.new(salary: person.salary, value: cont*12), employer_contribution: PensionsCalculator::Contribution.new(salary: person.salary, value: 0));
potvalue = pot.value_at(Date.new((2015+term), 02, 12))
print " #{potvalue},"
}
print "\n"
}
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment