>> Regexp.new("|(.)").match("a").captures.length
=> 1
On 5/21/07, RailsToPerl <[EMAIL PROTECTED]> wrote:
>
> In routing.rb, what is the purpose of the following piece of code:
>
> class Regexp #:nodoc:
> def number_of_captures
> Regexp.new("|#{source}").match('').captures.length
> end
>
>
> Does this method not always return 0? It's always going to match ''
> with the blank spot before the | and therefore will have no captures.
>
>
> >
>
--
Kevin Clark
http://glu.ttono.us
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---