diff options
author | Xavier Noria <fxn@hashref.com> | 2010-01-02 23:49:55 +0100 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2010-01-02 23:49:55 +0100 |
commit | 9c28fdaf8841ae017fed00c70a065a289193e309 (patch) | |
tree | f55cab0deb112fcd906889e75ffdb490c1a1a1e4 | |
parent | 1a95f44f21fa48a39b05621dd75555a952ffc1d4 (diff) | |
download | rails-9c28fdaf8841ae017fed00c70a065a289193e309.tar.gz rails-9c28fdaf8841ae017fed00c70a065a289193e309.tar.bz2 rails-9c28fdaf8841ae017fed00c70a065a289193e309.zip |
Regexp#(un)optionalize are also gone
-rw-r--r-- | railties/guides/source/active_support_core_extensions.textile | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile index d4931e0389..e755eceb1d 100644 --- a/railties/guides/source/active_support_core_extensions.textile +++ b/railties/guides/source/active_support_core_extensions.textile @@ -1620,31 +1620,6 @@ def assign_route_options(segments, defaults, requirements) end </ruby> -h4. +optionalize(pattern)+ - -The class method +optionalize+ builds a regexp where the pattern argument is optional. That roughly means it gets a question mark appended with a non-capturing group if needed: - -<ruby> -Regexp.optionalize('') # => '' -Regexp.optionalize('.') # => '.?' -Regexp.optionalize('...') # => '(?:...)?' -</ruby> - -This method is also used by the routing system, it helps in building optional regexp segments. - -h4. +unoptionalize(pattern)+ - -The class method +unoptionalize+ is the inverse of +optionalize+ for optional regexps, and the identity for the rest: - -<ruby> -Regexp.unoptionalize('') # => '' -Regexp.unoptionalize('.?') # => '.' -Regexp.unoptionalize('(?:...)?') # => '...' -Regexp.unoptionalize('\A\w+\z') # => '\A\w+\z' -</ruby> - -This method is also used in the routes code for building regexps. - h3. Extensions to +Range+ h4. +to_s+ |