LoanCalculator 是一個簡單小型的房貸計算器

jopen 8年前發布 | 36K 次閱讀 Ruby開發 LoanCalculator

LoanCalculator

LoanCalculator 是一個簡單小型的房貸計算器,提供等額本息還款計算和等額本金還款計算,別讓中介和銀行把你蒙了。

Installation

Add this line to your application's Gemfile:

gem 'loan_calculator', git: 'https://github.com/xiewnewei/loan_calculator.git'

And then execute:

$ bundle

Or install it yourself as:

$ gem install loan_calculator

Usage

# 貸款 100 萬,20 年,利率 4.9%,等額本息還款
  tool = LoanCalculator.get(100, 20, 4.9)
  # 顯示完整信息
  tool.display
  # 打印每月還款
  puts tool.month_amount

  # 貸款 100 萬,20 年,利率 4.9%,等額本金還款
  tool = LoanCalculator.get(100, 20, 4.9, :same_capital)
  # 顯示完整信息
  tool.display
  # 打印首月還款
  puts tool.month_amount

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/xiewenwei/loan_calculator. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.


項目地址: https://github.com/xiewenwei/loan_calculator

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!