Actions
Bug #13202
closedEnumerable#slice_before does not take both argument and block at the same time, as it ought to.
Bug #13202:
Enumerable#slice_before does not take both argument and block at the same time, as it ought to.
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.5.0dev (2017-02-02 trunk 57498) [x86_64-darwin15]
Backport:
Description
Both RDoc and Rurema have descriptions of Enumerable#slice_before with this example:
# 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"
prevemp && line.start_with?("From ")
}.each { |mail|
mail.pop if mail.last == "\n"
pp mail
}
}
which doesn't work.
Actions