Monee
Monee simply means nothing but Money and it is there as a namespace to avoid contradiction with existing gems.
This is a rubygem created with minimal features as required and engineered with very simple techniques showcasing few good practices in building a ruby project.
Following TDD practice, designed with few useful patterns, styled with rubocop style guide, documented with yard convention, lines of code analysis, 100% tests coverage and properly error handled rubygem project could be very useful to assess one's knowledge in build rubygems.
Installation
Add this line to your application's Gemfile:
gem 'monee'
And then execute:
$ bundle
Or install it yourself as:
$ gem install monee
Usage
1. Set the conversion rates
$ Monee::Money.conversion_rates('EUR', {
'USD' => 1.11,
'Bitcoin' => 0.0047
})
2. Start using as below,
$ fifty_eur = Monee::Money.new(50, 'EUR')
$ twenty_dollars = Monee::Money.new(20, 'USD')
$ fifty_eur + twenty_dollars # => 68.02 EUR
How to run the test suite
Use the following commands to run the test suites
$ cd monee
$ rspec
Tests Coverage(100%)
Once your run $ rspec then the commandline will generate the tests coverage under coverage directory. This is a static HTML file generated by the simplecov. You can view this file on your browser just like how you would open any other file on your browser. Here is how I opened in with mine.
Enter an URL that looks like below on your browser,
$ file:///Users/beck/BECK/interview/monee/coverage/index.html#_AllFiles
Steps to check LOC
To check the lines of code in this repository, you can use this simple shell script by executing the following command,
$ ./loc.sh
Yard Documentation
The entire code base is well documented following the yard coding comments conventions. To read the documentation of this rails app you can execute the following command,
$ yard server
and visit http://localhost:8808, to the yard documentation of this application.
0 offense(s) in Rubocop
This is really something to be proud about!
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
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/[USERNAME]/monee. 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.
License
The gem is available as open source under the terms of the MIT License.