[Chirb] Question...
Dave Hoover
dave at obtiva.com
Mon Jun 30 08:55:05 EDT 2008
+1 on this convention, which is similar to how ActiveSupport is structured.
http://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext
On Mon, Jun 30, 2008 at 7:10 AM, Paul Gross <pgross at gmail.com> wrote:
> I'm not sure if it's the only convention, but on my projects at
> ThoughtWorks, we put all of our modifications into a folder called core_ext.
> Each class modification gets one file, such as string_extension.rb,
> object_extension.rb, etc. We create modules and include them on the
> original class (as mentioned in Jay's linked post).
>
> Then, somewhere in the application, we have code to include them all like:
>
> Dir.glob(File.expand_path('/some/path/to/core_ext/*')).each do |ext|
> require ext
> end
>
> For rails, we made this an initializer.
>
> Thanks,
> Paul Gross
>
>
> Nate Kirby wrote:
>>
>> All,
>>
>> I feel kind of like a ruby nubie saying this, but all of my work in ruby
>> has been in rails. I just got some work that does not require rails. When
>> I work in rails, whenever metaprogramming is used to change the behavior of
>> say String#length, it has gone in application.rb, so all those kinds of
>> behavoir changes have been easy to locate. However, now, when working
>> without rails, these kinds of things go... well I assume there must be a
>> ruby convention for this. I have found
>> http://rubygarden.org/ruby/page/show/RubyStyleGuide and
>> http://blog.jayfields.com/2007/01/class-reopening-hints.html but am unsure
>> that the real ruby convention for changing a previously defined classes'
>> behavior is clear.
>>
>> Does anyone out there know the right answer? Where do class redefinitions
>> go according to ruby conventions?
>>
>> TIA,
>> Nate
>>
>>
>> _______________________________________________
>> ChicagoGroup-Members-List at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/chicagogroup-members-list
>
> _______________________________________________
> ChicagoGroup-Members-List at rubyforge.org
> http://rubyforge.org/mailman/listinfo/chicagogroup-members-list
More information about the ChicagoGroup-Members-List
mailing list