Shopify / measured

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

Simplify case sensitivity code #32

Closed thegedge closed 7 years ago

thegedge commented 7 years ago

Use something other than case_sensitive as state for Conversion. Some ideas include:

  1. Use dependency injection to supply a collection object that will store names/aliases. If case insensitivity is required, this collection should be able to hide that detail.
  2. Have a "name mapping" function in Conversion that can be overridden by another class (e.g., CaseSensitiveConversion would be the identity function and CaseInsensitiveConversion would be #downcase)
kmcphillips commented 7 years ago

I'm ok with this. Case sensitivity was added after and could probably be better thought out.

thegedge commented 7 years ago

Completed over several PRs (mostly https://github.com/Shopify/measured/pull/53 and https://github.com/Shopify/measured/pull/29)