Interests

Gem Version Build Status Code Climate

Factory shift methods collection by RubyLogic, PL

Installation

Add it to your Gemfile with:

gem 'interests'

Run the bundle command to install it.

Run generator if needed:

rails generate interests:config

Basic usage

Interests gem allows to calculate total interests between two dates

Interests::Calculator.total_interests(1000, Date.new(2014, 1, 1), Date.new(2014, 12, 31))

Moreover the gem provides access to the following extensions.

Date class exts

Date.new(2014, 1, 1).total_interests_till(1000, Date.new(2014, 12, 31))
# returns total interests from the 1st of January 2014 till 31st of December of 2014

Date.new(2014, 12, 31).total_interests_from(1000, Date.new(2014, 1, 1))
# returns total interests from the 1st of January 2014 till 31st of December of 2014

Fixnum and Float class exts

1000.total_interests(Date.new(2014, 1, 1), Date.new(2014, 12, 31))
# returns total interests from the 1st of January 2014 till 31st of December of 2014

12.99.total_interests(Date.new(2014, 1, 1), Date.new(2014, 12, 31))
# returns total interests from the 1st of January 2014 till 31st of December of 2014

License

Copyright © 2012 - 2015 Ruby Logic, released under the MIT license