зеркало из https://github.com/github/ruby.git
[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
This commit is contained in:
Родитель
3c06d3a6bd
Коммит
cd5f5715d7
7
enum.c
7
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"
|
||||
|
|
Загрузка…
Ссылка в новой задаче