Shopify / measured

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

Use module function and do not instantiate table unnecessarily #40

Closed kmcphillips closed 7 years ago

kmcphillips commented 7 years ago

@thegedge @benwah

Closes #38

Problem

Unnecessary to create an instance of the conversion table class to call a single function and throw it away.

Solution

Use a module function. Trade off is that we have to pass units down all the way through in a bunch of places.

In the 2.0 milestone, but doesn't change the interface at all for the 1.x version.

kmcphillips commented 7 years ago

If you feel strongly I'm ok with a 2.0 branch to save releases here. Doesn't really matter.

kmcphillips commented 7 years ago

Thanks