[Chirb] Question...
L. Franklin
lfranklin at lumatila.com
Mon Jun 30 08:12:05 EDT 2008
Nate,
When you leave the comfortable confines of rails, you discover that ruby has
a wild-wild west side to it. The only real convention that you see in Ruby
is that any code that you need to require/include in other code lives in a
/lib subdirectory on your project. You will need to put in the appropriate
requires/includes to make sure your code pulls in your metaprogramming. You
could store your metaprogramming and other includable routines elsewhere as
well; you just have to provide your requires an appropriate path to find
them. Another possibility is to deploy your metaprogramming as a gem which
will slightly simplify the task of your code finding it.
Another alternative that I have adopted on several non-rails projects is to
go ahead and use the core components of rails anyway, stripping out AR and
other un-needed pieces. This is a little easier to do with other frameworks
like merb which are more flexible about their components. The benefit of
this is that you can still utilize the portions of rails/merb that are
convenient and take advantage of the huge library of plug-ins and deployment
tools. I have taken this approach with several ruby applications that were
deployed as Windows executables using WxRuby as the GUI. In that case I
still had a sqllite database managed by AR, but I stripped out all of the
web components.
We can chat more about this off-list about the specifics if you have more
questions.
Thanks!
Lukass
-----Original Message-----
From: Nate Kirby [mailto:natebkirby at yahoo.com]
Sent: Sunday, June 29, 2008 8:37 PM
To: Chirb discussion list
Subject: [Chirb] Question...
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
No virus found in this incoming message.
Checked by AVG.
Version: 8.0.101 / Virus Database: 270.4.3/1525 - Release Date: 6/29/2008
3:09 PM
More information about the ChicagoGroup-Members-List
mailing list