From 1a95f44f21fa48a39b05621dd75555a952ffc1d4 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Sat, 2 Jan 2010 23:47:34 +0100 Subject: Regexp#number_of_captures is gone --- .../source/active_support_core_extensions.textile | 24 ---------------------- 1 file changed, 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: - - -%r{}.number_of_captures # => 0 -%r{.(.).}.number_of_captures # => 1 -%r{\A((#)(\w+|\s+))\z}.number_of_captures # => 3 - - -Routing code for example uses that method to generate path recognizers: - - -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 - - h4. +multiline?+ The method +multiline?+ says whether a regexp has the +/m+ flag set, that is, whether the dot matches newlines. -- cgit v1.2.3