Skip to content

Commit

Permalink
[DOC] Update an obsolete example for slice_before.
Browse files Browse the repository at this point in the history
The argument for Enumerable#slice_before is is removed at Ruby 2.3.

Reported by Shyouhei Urabe.  [Bug #13202]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57584 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
akr committed Feb 9, 2017
1 parent 3c06d3a commit cd5f571
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions enum.c
Original file line number Diff line number Diff line change
Expand Up @@ -3213,9 +3213,10 @@ slicebefore_i(RB_BLOCK_CALL_FUNC_ARGLIST(yielder, enumerator))
*
* # 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"
Expand Down

0 comments on commit cd5f571

Please sign in to comment.