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

ruby-changes:59651

From: Marcus <ko1@a...>
Date: Thu, 9 Jan 2020 05:08:23 +0900 (JST)
Subject: [ruby-changes:59651] 1d09acd82b (master): [DOC] Improve docs for String#match

https://git.ruby-lang.org/ruby.git/commit/?id=1d09acd82b

From 1d09acd82bc90c0794c0409e330ecc71a912d1b3 Mon Sep 17 00:00:00 2001
From: Marcus Stollsteimer <sto.mar@w...>
Date: Wed, 8 Jan 2020 20:53:31 +0100
Subject: [DOC] Improve docs for String#match

Fix invalid code to make it syntax highlighted; other small fixes.

diff --git a/string.c b/string.c
index af02cdd..2413fbf 100644
--- a/string.c
+++ b/string.c
@@ -3831,9 +3831,9 @@ static VALUE get_pat(VALUE); https://github.com/ruby/ruby/blob/trunk/string.c#L3831
  *     str.match(pattern, pos)   -> matchdata or nil
  *
  *  Converts <i>pattern</i> to a Regexp (if it isn't already one),
- *  then invokes its <code>match</code> method on <i>str</i>.  If the second
- *  parameter is present, it specifies the position in the string to begin the
- *  search.
+ *  then invokes its <code>match</code> method on the receiver.
+ *  If the second parameter is present, it specifies the position
+ *  in the string to begin the search.
  *
  *     'hello'.match('(.)\1')      #=> #<MatchData "ll" 1:"l">
  *     'hello'.match('(.)\1')[0]   #=> "ll"
@@ -3841,18 +3841,18 @@ static VALUE get_pat(VALUE); https://github.com/ruby/ruby/blob/trunk/string.c#L3841
  *     'hello'.match(/(.)\1/, 3)   #=> nil
  *     'hello'.match('xx')         #=> nil
  *
- *  If a block is given, invoke the block with MatchData if match succeed, so
- *  that you can write
+ *  If a block is given, invokes the block with MatchData if match succeeds,
+ *  so that you can write
  *
- *     str.match(pat) {|m| ...}
+ *     str.match(pat) {|m| block }
  *
  *  instead of
  *
  *     if m = str.match(pat)
- *       ...
+ *       # ...
  *     end
  *
- *  The return value is a value from block execution in this case.
+ *  The return value in this case is the value from block execution.
  */
 
 static VALUE
-- 
cgit v0.10.2


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

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