Advanced Rails - Building Industrial-Strength Web Apps in Record Time

(Tuis.) #1
Further Reading | 45

Theparameter_shellmethod returns the default set of parameters associated with
the route. This method body simply tests against the regular expression, populating
and returning theparamshash if the regular expression matches. If there is no match,
the method returnsnil.


Once this method body is created, it is evaluated in the context of the route using
instance_eval. This overwrites that particular route’srecognize method.


Further Reading


Minero AOKI’sRuby Hacking Guideis an excellent introduction to Ruby’s internals.
It is being translated into English athttp://rhg.rubyforge.org/.


Eigenclass (http://eigenclass.org/) has several more technical articles on Ruby.


Evil.rb is a library for accessing the internals of Ruby objects. It can change objects’
internal state, traverse and examine the klass and super pointers, change an
object’s class, and cause general mayhem. Use with caution. It is available athttp://
rubyforge.org/projects/evil/. Mauricio Fernández gives a taste of Evil athttp://eigenclass.
org/hiki.rb?evil.rb+dl+and+unfreeze.


Jamis Buck has a very detailed exploration of the Rails routing code, as well as sev-
eral other difficult parts of Rails, athttp://weblog.jamisbuck.org/under-the-hood.


One of the easiest-to-understand, most well-architectured pieces of Ruby software I
have seen is Capistrano 2, also developed by Jamis Buck. Not only does Capistrano
have a very clean API, it is extremely well built from the bottom up. If you haven’t
been under Capistrano’s hood, it will be well worth your time. The source is avail-
able via Subversion fromhttp://svn.rubyonrails.org/rails/tools/capistrano/.


Mark Jason Dominus’s bookHigher-Order Perl(Morgan Kaufmann Publishers) was
revolutionary in introducing functional programming concepts into Perl. When
Higher-Order Perlwas released in 2005, Perl was a language not typically known for
its functional programming support. Most of the examples in the book can be trans-
lated fairly readily into Ruby; this is a good exercise if you are familiar with Perl.
James Edward Gray II has written up his version in his “Higher-Order Ruby” series,
athttp://blog.grayproductions.net/categories/higherorder_ruby.


The Ruby Programming Language, by David Flanagan and Yukihiro Matsumoto
(O’Reilly), is a book covering both Ruby 1.8 and 1.9. It is due out in January 2008.
The book includes a section on functional programming techniques in Ruby.

Free download pdf