Open marcandre opened 4 years ago
prepend
or keep using alias_method_chain
?I wouldn't mind having a nicer API too. E.g.:
Backports.update :to_h, :transform_values, up_to: 2.7
That would still be susceptible to forward incompatiblities if the up_to
argument is optional.
/cc @zverok
Thinking about it a bit, I'd say this:
Enumerable#tally
) and methods whose behavior is redefined (Enumerable#to_h
)So, I think along this lines:
Backports.require! # requires all new methods, no redefinitions
Backports.require!(redefinitions: true) # all new and redefinitions
Backports.require!(redefinitions: true, except: %w[Enumerable#to_h]) # but not that one Backports.require!(only: %w[Enumerator.produce]) # I am picky today!
Backports.require!(upto: 2.6) # don't take nothing from 2.7
(For some cases, it will also require some reconciliation of "what means what", for example, if somebody asks for `Enumerable#to_h`, does that mean they want `Array#to_h` too? Most probably... But does that mean they also might want to opt-out of "just `Array#to_h`"?)
Backports v4 roadmap:
require 'backports'
a noop (or an error?)ETA: Xmas '20