variable stays in scope, which is not so
nice.
On Feb 14, 5:18 pm, Kai Middleton kai.middle...@gmail.com wrote:
I was looking at this bit of code within Rails:
# File actionpack/lib/action_controller/metal/flash.rb, line 12
def redirect_to(options = {}, response_status_and_flash = {}) #:doc
I also found this on stackoverflow:
http://stackoverflow.com/questions/3835170/ruby-assignment-and-comparison-in-one-line
On Feb 14, 5:18 pm, Kai Middleton kai.middle...@gmail.com wrote:
I was looking at this bit of code within Rails:
# File actionpack/lib/action_controller/metal/flash.rb
Yeah, great point. How to know how deep to go. I was looking at some
of the Ruby global vars:
http://www.rubyist.net/~slagell/ruby/globalvars.html
This one is similar:
$n the nth subexpression in the last match (same as $~[n])
But it seems somehow not so clean.
We have this nifty
Philip's idea seems pretty good:
^\w+
That says: look for any string that starts with one or more word
characters (letters, numbers, underscores).
Try it out in rubular:
http://rubular.com/
It let's you quickly experiment with lots of regular expressions and
has a quick-ref right there on the
4 matches
Mail list logo