Shopify / measured

Encapsulate measurements and their units in Ruby and Ruby on Rails.
MIT License
337 stars 28 forks source link

Have Measurable inherit from Numeric #44

Closed thegedge closed 7 years ago

thegedge commented 7 years ago

Closes https://github.com/Shopify/measured/issues/31

@kmcphillips @jonathankwok

thegedge commented 7 years ago

The more I'm thinking about this, the more I'm realizing that addition and subtraction against anything except a Measurable object part of the same system should raise a type error.

You should never be able to add or subtract without a unit.

Yeah, agreed. I'll push out a PR to change that.

thegedge commented 7 years ago

https://github.com/Shopify/measured/issues/46 for arithmetic changes