RubyMoney/money
69.9
Adequate · 5 November 2026
2.5k
lines of production code
Ruby
primary language
4
measurements over time
What this system is
This system is a Ruby library for managing monetary amounts and currency definitions, providing precise arithmetic, formatting, and currency conversion capabilities. It utilizes BigDecimal for infinite precision storage and features a modular architecture for allocation, exchange banking, and locale-based formatting. The library also includes thread-safe in-memory storage for exchange rates and static type signatures to support IDE integration and type checking.
How it got here
2008–2010 — Major library rewrite to v7.1.1
6 changes.
This period focused on a comprehensive rewrite of the Money library from version 6.x to 7.1.1, introducing a modular architecture and shifting internal storage from Integer cents to BigDecimal for infinite precision. The update replaced constant-based currency definitions with a new Money::Currency class and refactored exchange logic into distinct bank implementations. Foundational work included establishing the gemspec, setting up the RSpec test suite, and removing internal helper dependencies in favor of standard Ruby features.
2011–2018 — Modularization and thread-safety
5 changes.
The Money library underwent a significant architectural refactor, decomposing the core into modular components for arithmetic, allocation, and formatting to improve maintainability and performance. Concurrently, the project introduced thread-safe exchange rate storage and a pluggable locale backend abstraction to enhance concurrency support and localization flexibility.
2023–2025 — RBS type signature implementation
6 changes.
This period focused on adding comprehensive RBS type signatures for the Money library's core classes, bank modules, and rate stores to enable static type checking and improved IDE support. The work also included standardizing the test suite configuration and introducing Bundler binstubs to streamline the developer workflow.
Features
Add RBS type signatures for Money and Currency
This change introduces RBS type signature files for the Money and Currency classes, providing static type definitions for the library's public API. This enables better IDE support, type checking, and documentation for developers using the Money library in Ruby projects.
sig/lib/money · high confidence
Add RBS type signatures for Money library components
This change introduces RBS type signature files for the Money library, covering core arithmetic operations, allocation logic with configurable precision, formatting rules, and locale backends. These signatures provide static type checking and improved IDE support for the Money class and its modules.
sig/lib/money/money · high confidence
Add RBS type signatures for Money::Bank and Currency::Heuristics
This change introduces RBS signature files for the Money library's currency exchange and heuristic modules. It defines the type signatures for \Money::Bank::Base\, including its singleton instance, rounding method, and core exchange methods like \exchange\_with\ and \same\_currency?\. It also adds signatures for \Money::Bank::SingleCurrency\, which raises an error when attempting to exchange different currencies, and \Money::Bank::VariableExchange\, covering rate management methods such as \add\_rate\, \set\_rate\, \get\_rate\, and import/export functionality. Additionally, it includes a deprecated signature for \Money::Currency::Heuristics\.
sig/lib/money/bank · high confidence
Initial release of Money 7.1.1
This entry marks the initial release of the Money library (version 7.1.1) in this repository. It introduces a comprehensive currency and money management system for Ruby, featuring a \Money\ class for handling amounts and a \Money::Currency\ class for currency definitions. Key capabilities include arithmetic operations, currency conversion via exchange banks, and flexible formatting with support for i18n and custom rules. The release includes RBS type signatures, a new \Money::Currency.reset!\ method, and fixes for allocation precision and JSON rate parsing security issues.
(repo-wide) · high confidence
Behavioural changes
Added Bundler binstubs for rake, rbs, rspec, and rubocop
The project now includes generated binstubs in the \bin/\ directory for rake, rbs, rspec, and rubocop. These scripts allow developers to run these tools directly (e.g., \./bin/rake\) without needing to prefix commands with \bundle exec\, simplifying the command-line workflow while ensuring the correct gem versions are loaded via Bundler.
bin · high confidence
Added type signatures for the in-memory exchange rate store
Introduced RBS type signatures for the \Money::RatesStore::Memory\ class, defining the interface for thread-safe storage of exchange rate pairs. This includes type definitions for initialization, adding and retrieving rates, iterating over stored rates, and internal transaction handling, enabling static type checking for applications using the in-memory rate store.
_sig/lib/money/rates\store · high confidence
Deprecation of built-in currency heuristics and introduction of explicit loader
The built-in currency identification heuristics have been removed from the core library; calling \Money::Currency.analyze\ now raises a deprecation error instructing users to add the \money-heuristics\ gem to their Gemfile. Additionally, currency loading has been refactored to use a dedicated \Money::Currency::Loader\ module that explicitly reads from JSON files in the config directory, replacing the previous implicit loading mechanism.
lib/money/currency · high confidence
Introduce Money::Bank::Base and new SingleCurrency bank
The currency exchange architecture has been refactored to include a new abstract base class, Money::Bank::Base, which defines the core interface for bank implementations (including a setup hook and rounding method) and a dedicated Money::Bank::SingleCurrency class that prevents cross-currency exchanges by raising an error. This change restructures the existing Money::Bank::VariableExchange to inherit from this new base, decoupling the rate storage logic into a separate Money::RatesStore::Memory component while maintaining the same public API for adding and exchanging rates.
lib/money/bank · high confidence
Introduce locale\_backend abstraction for currency formatting
The library now uses a pluggable \LocaleBackend\ abstraction to handle currency formatting lookups, replacing the previous direct implementation. This change introduces a \Base\ class and two concrete backends: \I18n\, which maps formatting keys (like \thousands\_separator\ and \symbol\) to I18n translation scopes, and \Currency\, which allows explicit per-currency localization via method calls. This structure enables more flexible and testable locale handling for money formatting.
_lib/money/locale\backend · high confidence
Major library rewrite: modular architecture, BigDecimal precision, and new Currency class
The Money library has been rewritten from version 6.x to 7.1.1, introducing a modular structure with separate modules for arithmetic, constructors, formatting, allocation, and locale backends. The internal storage for monetary amounts has shifted from Integer cents to BigDecimal to support infinite precision and avoid floating-point errors. A new Money::Currency class replaces the previous constant-based currency definitions, providing a singleton-based registry with support for inheritance, dynamic registration, and ISO 4217 numeric lookups. Currency exchange logic has been refactored into distinct bank implementations (VariableExchange and SingleCurrency) replacing the old NoExchangeBank and VariableExchangeBank. Core extensions for Numeric and String have been removed in favor of the Monetize gem. Users should note that methods like \#cents are now aliases for \#fractional, and formatting behavior has been standardized through a dedicated Formatter class.
lib/money · high confidence
Refactored Money core into modular components with stricter comparison and allocation logic
The Money class has been restructured into separate modules (Allocation, Arithmetic, Constructors, Formatter, FormattingRules, LocaleBackend) to improve maintainability and performance. Key behavioral changes include: 1) Stricter equality checks: \eql?\ now returns false for zero amounts in different currencies by default (with a deprecation warning), and \==\ raises an error when comparing with non-zero numerics. 2) Improved allocation: The new \Allocation\ module ensures precise distribution of amounts across parts, supporting configurable decimal precision and handling edge cases like all-zero parts. 3) Enhanced formatting: The \Formatter\ and \FormattingRules\ modules provide more flexible currency formatting options, including support for South Asian number formatting, HTML wrapping, and customizable delimiters. 4) Constructor methods: New class methods like \us\_dollar\, \euro\, and \pound\_sterling\ simplify creating Money instances for specific currencies. 5) Locale backend abstraction: Introduced a pluggable locale backend system supporting both I18n and currency-specific localization.
lib/money/money · high confidence
Removes internal cattr\_accessor and adds standard library dependencies
The library no longer includes its own \cattr\_accessor\ helper, removing the \lib/support/cattr\_accessor.rb\ file and replacing it with standard Ruby features. Additionally, \lib/money.rb\ now explicitly requires \bigdecimal\, \set\, and \i18n\, ensuring these dependencies are loaded before the core Money class initializes.
lib · high confidence
Thread-safe exchange rate storage in Money::RatesStore::Memory
The library now includes a new \Money::RatesStore::Memory\ class that provides thread-safe storage for exchange rate pairs, replacing the previous internal storage mechanism in \Bank::VariableExchange\. This store uses a \Monitor\ to synchronize all data access (adding, retrieving, and iterating rates), ensuring safe concurrent usage. It also supports serialization via \marshal\_dump\, allowing the store's state to be safely saved and restored.
_lib/money/rates\store · high confidence
Test coverage
Added comprehensive test coverage for Money core components; Initial RSpec test suite for Money class; Test suite support files for RSpec configuration and warning suppression.
Dependencies
Initial gemspec and Gemfile setup for Money gem v6.13.3
This change introduces the foundational dependency manifests for the Money gem. The gemspec defines the library's core runtime dependencies on \bigdecimal\ and \i18n\ (version \~\> 1.9), sets the minimum required Ruby version to 3.1, and includes gem metadata for changelog and source code links. The Gemfile establishes the development environment, specifying test tools (RSpec \~\> 3.4, SimpleCov), linting suites (Rubocop and its extensions), and documentation generators (Yard, RDoc, Redcarpet).
(dependencies) · high confidence
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 71 → 70 (-0.7)
- Rubric changed (rubric-2026.10.5 → rubric-2026.11.2) — scores are not directly comparable.
Lenses
- Code Health 74 → 74 (+0.0)
- Architecture 96 → 96 (+0.0)
- Maturity 61 → 60 (-0.8)
- Readiness 75 → 75 (+0.0)
- Security 94 → 90 (-4.0)
Resolved (6)
- Duplicate methods with different names performing the same operation. One is a verb-noun phrase (round_to...) and the other is a noun-verb phrase (to_nearest...), but both imply rounding to the smallest denomination.
- Inconsistent API for currency conversion. exchange_to is generic, while as_* methods are hardcoded to specific currencies. This forces users to use different methods depending on whether they want a generic conversion or a specific one, rather than a unified convert_to(currency) interface.
- Inconsistent accessor naming for numeric values. dollars() and amount() likely return the same float/decimal representation, while cents() and fractional() likely return the same integer representation. Having two names for the same concept (e.g., dollars vs amount) creates confusion about which to use.
- Off-boarding risk: anonymized user #1
- Redundant constructors with ambiguous intent. from_dollars implies a specific unit (dollars) but accepts a generic currency argument, which is confusing. It duplicates the functionality of from_amount but with a misleading name that suggests it only works for USD.
- While these are polymorphic implementations, the naming exchange_with is slightly inconsistent with the general Money object method exchange_to. The Bank methods take from and to explicitly, whereas the Money method takes other_currency (implying from is self). This is a minor inconsistency in argument semantics between the domain objects.
New (1)
- Off-boarding risk: anonymized user #1
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
RubyMoney/money was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 5 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 1d60efeaeea009cfc69374421561b23b851bd36e — the exact code this score is about.
- Scored under rubric-2026.11.2 — the same rubric and the same method as every other entry in this index.
- Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.2+preprod-5c4e66d9318b.