ruby-changes:45511
From: akr <ko1@a...>
Date: Thu, 9 Feb 2017 23:28:32 +0900 (JST)
Subject: [ruby-changes:45511] akr:r57584 (trunk): [DOC] Update an obsolete example for slice_before.
akr 2017-02-09 23:28:27 +0900 (Thu, 09 Feb 2017) New Revision: 57584 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57584 Log: [DOC] Update an obsolete example for slice_before. The argument for Enumerable#slice_before is is removed at Ruby 2.3. Reported by Shyouhei Urabe. [Bug #13202] Modified files: trunk/enum.c Index: enum.c =================================================================== --- enum.c (revision 57583) +++ enum.c (revision 57584) @@ -3213,9 +3213,10 @@ slicebefore_i(RB_BLOCK_CALL_FUNC_ARGLIST https://github.com/ruby/ruby/blob/trunk/enum.c#L3213 * * # split mails in mbox (slice before Unix From line after an empty line) * open("mbox") { |f| - * f.slice_before(emp: true) { |line, h| - * prevemp = h[:emp] - * h[:emp] = line == "\n" + * emp = true + * f.slice_before { |line| + * prevemp = emp + * emp = line == "\n" * prevemp && line.start_with?("From ") * }.each { |mail| * mail.pop if mail.last == "\n" -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/