[前][次][番号順一覧][スレッド一覧]

ruby-changes:23925

From: drbrain <ko1@a...>
Date: Sat, 9 Jun 2012 08:19:38 +0900 (JST)
Subject: [ruby-changes:23925] drbrain:r35976 (trunk): * doc/re.rdoc: Completed wording in the description of the =~ operator.

drbrain	2012-06-09 08:17:00 +0900 (Sat, 09 Jun 2012)

  New Revision: 35976

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=35976

  Log:
    * doc/re.rdoc:  Completed wording in the description of the =~ operator.
      [ruby-trunk - Bug #6529]

  Modified files:
    trunk/ChangeLog
    trunk/doc/re.rdoc

Index: doc/re.rdoc
===================================================================
--- doc/re.rdoc	(revision 35975)
+++ doc/re.rdoc	(revision 35976)
@@ -32,11 +32,15 @@
 === <tt>=~</tt> operator
 
 <tt>=~</tt> is Ruby's basic pattern-matching operator.  When one operand is a
-regular expression and is a string (this operator is equivalently defined by
-Regexp and String). If a match is found, the operator returns index of first
-match in string, otherwise it returns +nil+.
+regular expression and the other is a string then the regular expression is
+used as a pattern to match against the string.  (This operator is equivalently
+defined by Regexp and String so the order of String and Regexp do not matter.
+Other classes may have different implementations of <tt>=~</tt>.)  If a match
+is found, the operator returns index of first match in string, otherwise it
+returns +nil+.
 
     /hay/ =~ 'haystack'   #=> 0
+    'haystack' =~ /hay/   #=> 0
     /a/   =~ 'haystack'   #=> 1
     /u/   =~ 'haystack'   #=> nil
 
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 35975)
+++ ChangeLog	(revision 35976)
@@ -1,3 +1,8 @@
+Sat Jun  9 08:16:47 2012  Eric Hodel  <drbrain@s...>
+
+	* doc/re.rdoc:  Completed wording in the description of the =~ operator.
+	  [ruby-trunk - Bug #6529]
+
 Sat Jun  9 08:09:38 2012  Eric Hodel  <drbrain@s...>
 
 	* string.c (rb_str_start_with):  Removed "p" from start_with? examples

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]