This is a representation of Money (and various arbitrary currencies), created with usage within the Rails framework in mind, although it can stand alone as long as you are okay with including ActiveModel for validations and a few ActiveSupport helpers (although those can be handled differently if there is enough desire to decouple this from those dependencies).
Its greatest utility will come when used with ActiveRecord objects stored as database rows, where combined with ActiveRecord’s ‘composed_of` statement, you are able to separate the tedious money-related logic within your classes which utilize the abstraction.
Out of convenience, this is written for Ruby 1.9, although there shouldn’t be many changes required ot make this 1.8 compatible. RCov is not listed as a dependency since 1.9 setups should use simplecov instead.
# Put the following in your Gemfile: gem 'money', github: 'caleon/money'
-
JavaScript library for hooking into the Money behaviors in the frontend for Internationalization (needs to be ported)
-
Rails-ready class methods for models to conveniently set up the composed_of calls
-
Customizable formatting rules per currency
-
Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet.
-
Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it.
-
Fork the project.
-
Start a feature/bugfix branch.
-
Commit and push until you are happy with your contribution.
-
Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.
-
Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
Copyright © 2012 caleon. See LICENSE.txt for further details.