All notable changes to Unitwise will be documented in this file, starting at version 1.0.0.
Unitwise uses semantic versioning.
- Support for newer Rubies (2.6+) & drops support for older ones (2.6 is EOL but will continue to support for now)
- Support for Psych 4. Note: unit data YAML files in the gem are loaded using
unsafe_load
- Default units now stored as BigDecimal or Integer to reduce floating point accuracy loss.
- Added missing conversion for Degree Réaumur.
- Performing mathematical operations or converting units will now use Rational
math to prevent accuracy loss. In most cases, this means converted/operated
on
Measurement
s will have aRational
#value
. If you have an explicit dependency on the exactNumeric
type thatMeasurement#value
returns, consider using#to_f
or#to_i
instead.
- Support for MRI 2.1
- Support for Ruby MRI 1.9.3, MRI 2.0, and Rubinius
Unitwise.register
is a new method that allows user defined units- Support for MRI 2.3 and 2.4
- Unit data refreshed from latest UCUM spec. Most notably, some metric atoms names have seen case changes.
- Gem dependencies are less restrictive; now works with additional versions of parslet and blankslate.
- 'unitwise/ext' is now officially removed. The core Numeric extensions are no
longer available. Instead of
1.volt
or2.0.to_joule
, useUnitwise(1, 'volt')
andUnitwise(2.0, 'Joule')
. - Dropped support for Ruby 1.8.7, 1.9.2, and REE.
#to_s
should no longer return the unexpected ' 1' suffix for dimless measurements.#to_s(mode)
will fall back to using the atom'sprimary_code
if the mode isn't available.
require unitwise/ext
has been deprecated as it is a performance drag and violates Ruby best practices. Userequire unitwise
instead. Any use of the Numeric helpers like1.meter
,2.to_foot
will need to change toUnitwise(1, 'meter')
, andUnitwise(2, 'foot')
.
- Added Ruby 2.2 support.
- Empty strings are no longer valid units.
- Unitwise.valid? for checking validity of expressions
- Decomposer caching is now a little smarter. This resulted in a mild performance increase.
- Move conditional dependencies to Gemfile in order to allow proper installation issues on rbx and jruby.
- Uniwise() now accepts a Unitwise::Measurement as the first argument.
- Unitwise::Measurement now supports #round.
- Respect Rationals when inspecting/printing a Unitwise::Measurement.
- Dynamically created methods from unitwise/ext now work with #respond_to? and #methods appropriately.
- Unitwise() and Unitwise::Measurement.new() now requires two non-optional arguments (value and unit).
- Unitwise::Measurement no longer has an implicit Integer conversion.