Open thegedge opened 7 years ago
Few points about this. If we decide we want to:
ActiveSupport
does times for a reference implementation. One of the major reasons we built rather than used was that so many existing tools overrode core types and added methods globally. That's dangerous behaviour, unless you opt into wanting it.
Yep, I really should have mentioned that I intended for this to be opt-in, similar to bigdecimal/util
adding to_d
to a bunch of core types. Thanks for calling that out!
@kmcphillips what do you think of having Measured.build(add_numeric_extensions: true)
to support this? Or do you think it would be better to have something like require 'measured/numeric_extensions'
that wraps Measured.build
? I'm thinking something like the latter, because it would be the only way for us to have extensions for Length
/ Weight
.
This doesn't need to be part of the DSL. I'd much rather it be an optional, not included by default, extension that you can require.
For example,
1.metres
.