3 ms·
Yet this is what Ruby does, AFAIK. Numeric#days is an ActiveSupport method, not core Ruby. But yes, it does patch the behaviour into a core class. This is a b
by matthewmacleod 13y ago
Yet this is what Ruby does, AFAIK.
Numeric#days is an ActiveSupport method, not core Ruby. But yes, it does patch the behaviour into a core class.
This is a bit of a legacy of Ruby programming, and it's definitely bad to pollute the global namespace. However, I expect we'll see eventual use of Refinements (http://www.rubyinside.com/ruby-refinements-an-overview-of-a-new-proposed-ruby-feature-3978.html http://www.rubyinside.com/ruby-refinements-an-overview-of-a-...) now that they are available; this will allow classes to override core methods without affecting other classes out of scope.
- philwelch 13y agoRefinements do a little less than previously advertised three years ago, and as far as language features go I don't think they're worth the performance implications.