Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Ruby
  3. Measured

Measured

MITRuby

A Ruby library for encapsulating measurements with their units, providing precise conversion and Rails integration.

GitHubGitHub
385 stars28 forks0 contributors

What is Measured?

Measured is a Ruby library that encapsulates measurements with their units, allowing developers to work with quantities like weight, length, and volume in a type-safe and precise manner. It solves the problem of handling unit conversions accurately by using Rational numbers to avoid floating-point errors and provides seamless integration with Ruby on Rails for database persistence.

Target Audience

Ruby and Ruby on Rails developers who need to handle measurements and unit conversions in their applications, such as e-commerce platforms, scientific tools, or inventory management systems.

Value Proposition

Developers choose Measured for its precision, lightweight design, and native Rails integration without monkey-patching core Ruby classes. It offers a clean, extensible API and avoids the complexity and maintenance issues found in alternative gems.

Overview

Encapsulate measurements and their units in Ruby and Ruby on Rails.

Use Cases

Best For

  • Handling weight, length, and volume measurements in Ruby applications
  • Building e-commerce platforms that require precise unit conversions
  • Integrating measurement data with Rails models and databases
  • Parsing measurement strings from user input or external sources
  • Extending with custom units and conversion rates for domain-specific needs
  • Performing arithmetic operations on measurements with different units

Not Ideal For

  • Projects requiring a wide array of pre-defined units beyond weight, length, and volume, such as time, temperature, or electrical measurements
  • Applications that need to perform multiplication or division of measurements by other measurements, as only scalar scaling is supported
  • Non-Ruby or non-Rails environments where the ActiveRecord integration adds unnecessary complexity

Pros & Cons

Pros

Precision-Focused Conversions

Uses Rational and BigDecimal for all calculations to avoid floating-point errors, as emphasized in the README for accurate unit conversions.

Seamless Rails Integration

Includes an Active Record adapter for database persistence and built-in validations, making it straightforward to store and validate measurements in Rails models without external gems.

Extensible Unit System

Offers a simple DSL to define custom units and conversion rates, allowing easy extension for domain-specific needs, as shown in the 'Adding new units' section.

Convenient String Parsing

Can parse measurements directly from strings like '123 grams' with automatic whitespace handling and alias support, simplifying user input processing.

Cons

Limited Built-In Units

Only bundles units for weight, length, and volume by default, requiring manual definition for other measurement types, which can be tedious for complex applications.

No Unit-to-Unit Arithmetic

Does not support multiplication or division of measurements by other measurements, only scaling by scalars, restricting advanced scientific or engineering calculations.

Rails-Centric Design

While usable standalone, the gem is optimized for Rails with ActiveRecord, so non-Rails projects might find the API bloated or difficult to adapt without the Rails ecosystem.

Frequently Asked Questions

Quick Stats

Stars385
Forks28
Contributors0
Open Issues8
Last commit1 month ago
CreatedSince 2015

Tags

#unit-conversion#si-units#rational-numbers#measurement#active-record#rails-integration#ruby-on-rails#ruby

Built With

R
Ruby
A
Active Record
R
Ruby on Rails

Included in

Ruby14.1k
Auto-fetched 1 day ago

Related Projects

Ruby UnitsRuby Units

A unit handling library for ruby

Stars545
Forks112
Last commit9 months ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub