On Fri, Apr 16, 2010 at 1:57 AM, Evgeniy Dolzhenko <[email protected]> wrote: > ruby-1.9.2-head > "".method(:pluralize).source_location > => ["/mnt/hgfs/ubuntu_shared/edge/vendor/rails/activesupport/lib/ > active_support/core_ext/string/inflections.rb", 15] > > But overall to me this decision certainly makes sense since the > modules > which were created to store core extensions were kind of useless and > created deep nesting like ActiveSupport::CoreExtensions::String > obscuring the final purpose of exactly extending just String. > > So IMO that's a scannability win. > > On Apr 8, 4:21 am, Ryan Bigg <[email protected]> wrote: >> Greetings, >> >> I've seen a couple of people ask about why core extensions in Rails 3 are >> now extensions to the class. I haven't had or heard of a clear enough answer >> so I tend to steer away. Until today. >> >> Toby Tripp tweeted the >> following:http://twitter.com/tobytripp/status/11793190224. >> >> I think this is a fantastic point. How else am I able to determine if a >> method is Ruby core or Rails core extension easily otherwise, without >> referencing the documentation? I can imagine that the core extensions were >> done this way to add to the speed of loading them, but again, I do not know >> the clear reason. >> >> Could someone clarify as to why it was done this way rather than extending >> the classes with modules that are included? Thank you! >> >> -- >> Ryan Bigg / Radar
We'll be moving these to a single extension module per class rather than directly reopening classes. This preserves the ability to just require 'active_support/core_ext/string/inflections' without having to manually include the module, without leading to a proliferation of extensions in the class' ancestor chains. Plus, it makes documentation extremely clear and easy to read. All the string extensions in one place. And, this allows users to override core methods without needing to alias_method_chain the Active Support override. The AS extension can just call super to pick it up. jeremy -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
