From d05e153ee6a01ae7cea736d48ce784edc301c04c Mon Sep 17 00:00:00 2001 From: Aleksander Kwiatkowski Date: Mon, 20 Feb 2012 14:11:09 +0100 Subject: [PATCH] cleaning --- .rvmrc | 5 ++--- Rakefile | 20 +------------------- lib/monetico/loan.rb | 30 ------------------------------ spec/loan_spec.rb | 29 ----------------------------- spec/money_round_spec.rb | 14 -------------- 5 files changed, 3 insertions(+), 95 deletions(-) diff --git a/.rvmrc b/.rvmrc index f357ddc..ca9e207 100644 --- a/.rvmrc +++ b/.rvmrc @@ -1,4 +1,3 @@ -#rvm_gemset_create_on_use_flag=1 -#rvm gemset use monetico - +rvm_gemset_create_on_use_flag=1 +rvm gemset use monetico rvm use 1.9.3@monetico --create diff --git a/Rakefile b/Rakefile index 380d971..0d17dde 100644 --- a/Rakefile +++ b/Rakefile @@ -1,7 +1,7 @@ # encoding: utf-8 #!/usr/bin/env rake -#require "bundler/gem_tasks" +require "bundler/gem_tasks" require 'rubygems' require 'bundler' @@ -14,24 +14,6 @@ rescue Bundler::BundlerError => e end require 'rake' -#require 'jeweler' -#Jeweler::Tasks.new do |gem| -# # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options -# gem.name = "gem name" -# gem.homepage = "http://github.com/zaiste/monetico" -# gem.license = "licence" -# gem.summary = %Q{summary} -# gem.description = %Q{desc} -# gem.email = "..." -# gem.authors = ["..."] -# # dependencies defined in Gemfile -# -# gem.files = FileList[ -# "[A-Z]*", "{bin,generators,lib,test}/**/*" -# ] -#end -#Jeweler::RubygemsDotOrgTasks.new - require 'rspec/core' require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) do |spec| diff --git a/lib/monetico/loan.rb b/lib/monetico/loan.rb index 6476414..2c3778f 100644 --- a/lib/monetico/loan.rb +++ b/lib/monetico/loan.rb @@ -210,36 +210,6 @@ def round_paybacks(res) return res end - # temporary - - #def capital_real - # r(@amount / @no_installments) - #end - - #def total_interests_real_float - # if const? - # par = (1 + @interest_rate) ** @no_installments - # payback_amount = @amount * @interest_rate * par / (par - 1) - # res = payback_amount * @no_installments - @amount - # else - # res = 0.5.big * @interest_rate * @no_installments * (@amount + capital_real) - # end - # res - #end - - #def total_interests_real - # r(total_interests_float) - #end - - #def interests_real(idx) - # if const? - # res = interests_for_period(idx) - # else - # res = (@amount - (idx - 1) * capital_real) * @interest_rate - # end - # r(res) - #end - end end diff --git a/spec/loan_spec.rb b/spec/loan_spec.rb index f05f937..13d0adf 100644 --- a/spec/loan_spec.rb +++ b/spec/loan_spec.rb @@ -102,34 +102,5 @@ end - #it "should calculate loan" do - # amount = 1000.0 - # interest_rate = 0.2 - # number_of_installments = 3 - # #cadence = :weekly - # cadence = :monthly - # kind = :const - # #kind = :desc - # - # loan_calc = Monetico::Loan.new(amount, interest_rate, number_of_installments, cadence, kind) - # puts loan_calc.to_yaml - # - # loan_calc.payback(1..number_of_installments).each do |l| - # #puts lo_nu.inspect - # puts l[:amount].to_f - # puts l[:interests].to_f - # puts l[:capital].to_f - # puts l[:balance].to_f - # puts "*" - # #payback_items.create( - # # number: lo_nu[:no], - # # pay_day: created_at + lo_nu[:no].send(period), - # # interests: lo_nu[:interests], - # # capital: lo_nu[:capital], - # # balance: lo_nu[:balance] - # #) - # end - #end - end diff --git a/spec/money_round_spec.rb b/spec/money_round_spec.rb index 0137fcf..902ebfa 100644 --- a/spec/money_round_spec.rb +++ b/spec/money_round_spec.rb @@ -20,20 +20,6 @@ end it "should round simple loan results" do - #344.50566129375136 - #16.666666666666668 - #327.8389946270847 - #689.0113225874981 - #* - #344.50566129375136 - #11.20268342288194 - #333.3029778708694 - #344.5056612937467 - #* - #344.50566129375136 - #5.647633791700789 - #338.85802750205056 - ma = Monetico::MoneyArray.new # also testes using floats ma << BigDecimal.new("327.8389946270847")