Shopify / measured

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

Remove base unit #60

Closed kmcphillips closed 7 years ago

kmcphillips commented 7 years ago

We define base unit without a value, then a unit value: 'other unit'.

Explore if we can remove the base altogether. Building the parse graph may be more complex, but we can experiment with just processing them in order and not depending on a base.

This may help us with #59 that don't share a common zero point, and simply express units relative to other units.

thegedge commented 7 years ago

It's definitely unused. I love 🔥 ing code.

kmcphillips commented 7 years ago

It may be as simple as rather than saying:

base :g
unit :kg, value: "1000 g"

We can just give everything a value:

unit :g, value: "0.001 kg"
unit :kg, value: "1000 g"
kmcphillips commented 7 years ago

Or maybe even just 1