diff options
author | Xavier Noria <fxn@hashref.com> | 2010-01-02 23:47:34 +0100 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2010-01-02 23:47:34 +0100 |
commit | 1a95f44f21fa48a39b05621dd75555a952ffc1d4 (patch) | |
tree | df0987b408e024c2f28a02651ed71df877ca2f9d /railties/guides/source | |
parent | 37c76c13dab5fa9a2d562f8d9019f4b63427870c (diff) | |
download | rails-1a95f44f21fa48a39b05621dd75555a952ffc1d4.tar.gz rails-1a95f44f21fa48a39b05621dd75555a952ffc1d4.tar.bz2 rails-1a95f44f21fa48a39b05621dd75555a952ffc1d4.zip |
Regexp#number_of_captures is gone
Diffstat (limited to 'railties/guides/source')
-rw-r--r-- | railties/guides/source/active_support_core_extensions.textile | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile index e4d0859933..d4931e0389 100644 --- a/railties/guides/source/active_support_core_extensions.textile +++ b/railties/guides/source/active_support_core_extensions.textile @@ -1596,30 +1596,6 @@ NOTE: Defined in +active_support/core_ext/hash/indifferent_access.rb+. h3. Extensions to +Regexp+ -h4. +number_of_captures+ - -The method +number_of_captures+ returns the number of capturing groups in a given regexp: - -<ruby> -%r{}.number_of_captures # => 0 -%r{.(.).}.number_of_captures # => 1 -%r{\A((#)(\w+|\s+))\z}.number_of_captures # => 3 -</ruby> - -Routing code for example uses that method to generate path recognizers: - -<ruby> -def recognition_extraction - next_capture = 1 - extraction = segments.collect do |segment| - x = segment.match_extraction(next_capture) - next_capture += segment.number_of_captures - x - end - extraction.compact -end -</ruby> - h4. +multiline?+ The method +multiline?+ says whether a regexp has the +/m+ flag set, that is, whether the dot matches newlines. |