summaryrefslogtreecommitdiff
path: root/enum.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-02-09 14:28:27 (GMT)
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-02-09 14:28:27 (GMT)
commitcd5f5715d703b75d520f9624e33b100fecb078e2 (patch)
tree1438243e844bacc28019921159e5becb1f2c0018 /enum.c
parent3c06d3a6bd2051fb2c321e04291951ae8df127bc (diff)
[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] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57584 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enum.c')
-rw-r--r--enum.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/enum.c b/enum.c
index 7dd1ae3..e9d5684 100644
--- a/enum.c
+++ b/enum.c
@@ -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"