* re.c: Update documentation for Regexp class.

[fix GH-937][ci skip] Patch by @davydovanton

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
hsbt 2015-06-24 03:21:21 +00:00
parent 1782dd8cd7
commit 7fac69128c
2 changed files with 16 additions and 12 deletions

View File

@ -1,3 +1,8 @@
Wed Jun 24 12:21:16 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
* re.c: Update documentation for Regexp class.
[fix GH-937][ci skip] Patch by @davydovanton
Wed Jun 24 09:23:03 2015 Eric Wong <e@80x24.org> Wed Jun 24 09:23:03 2015 Eric Wong <e@80x24.org>
* variable.c (generic_ivar_set): remove FL_ABLE check * variable.c (generic_ivar_set): remove FL_ABLE check

23
re.c
View File

@ -1688,10 +1688,6 @@ match_array(VALUE match, int start)
} }
/* [MG]:FIXME: I put parens around the /.../.match() in the first line of the
second example to prevent the '*' followed by a '/' from ending the
comment. */
/* /*
* call-seq: * call-seq:
* mtch.to_a -> anArray * mtch.to_a -> anArray
@ -1707,7 +1703,7 @@ match_array(VALUE match, int start)
* accessing the fields directly (as an intermediate array is * accessing the fields directly (as an intermediate array is
* generated). * generated).
* *
* all,f1,f2,f3 = *(/(.)(.)(\d+)(\d)/.match("THX1138.")) * all,f1,f2,f3 = * /(.)(.)(\d+)(\d)/.match("THX1138.")
* all #=> "HX1138" * all #=> "HX1138"
* f1 #=> "H" * f1 #=> "H"
* f2 #=> "X" * f2 #=> "X"
@ -2924,12 +2920,16 @@ rb_reg_match2(VALUE re)
* If a block is given, invoke the block with MatchData if match succeed, so * If a block is given, invoke the block with MatchData if match succeed, so
* that you can write * that you can write
* *
* pat.match(str) {|m| ...} * /M(.*)/.match("Matz") do |m|
* puts m[0]
* puts m[1]
* end
* *
* instead of * instead of
* *
* if m = pat.match(str) * if m = /M(.*)/.match("Matz")
* ... * puts m[0]
* puts m[1]
* end * end
* *
* The return value is a value from block execution in this case. * The return value is a value from block execution in this case.
@ -2964,15 +2964,14 @@ rb_reg_match_m(int argc, VALUE *argv, VALUE re)
/* /*
* Document-method: compile * Document-method: compile
* *
* Synonym for <code>Regexp.new</code> * Alias for <code>Regexp.new</code>
*/ */
/* /*
* call-seq: * call-seq:
* Regexp.new(string, [options [, kcode]]) -> regexp * Regexp.new(string, [options [, kcode]]) -> regexp
* Regexp.new(regexp) -> regexp * Regexp.new(regexp) -> regexp
* Regexp.compile(string, [options [, kcode]]) -> regexp * Regexp.compile(string, [options [, kcode]]) -> regexp
* Regexp.compile(regexp) -> regexp * Regexp.compile(regexp) -> regexp
* *
* Constructs a new regular expression from +pattern+, which can be either a * Constructs a new regular expression from +pattern+, which can be either a