diff options
author | Yusuke Endoh <[email protected]> | 2019-10-22 19:46:44 +0900 |
---|---|---|
committer | Yusuke Endoh <[email protected]> | 2019-10-22 19:46:44 +0900 |
commit | 02aadf1032d71a3f81653a955f2635c8853b0aca (patch) | |
tree | 03675552d927d08c4e430bb6eb81d9cdee955388 | |
parent | fac4339a1273df64fe764579f0d3ccccf64b74b4 (diff) |
NEWS: Fix the example of Lazy#eagerv2_7_0_preview2
-rw-r--r-- | NEWS | 10 |
1 files changed, 3 insertions, 7 deletions
@@ -252,13 +252,9 @@ Enumerator:: from a lazy enumerator. [Feature #15901] a = %w(foo bar baz) - e = a.lazy - .map {|x| p [x, :upcase]; x.upcase } - .map {|x| p [x, :add_bang]; x + "!" } - .eager - p e.next #=> ["foo", :upcase], ["FOO", :add_bang], "FOO!" - p e.next #=> ["bar", :upcase], ["BAR", :add_bang], "BAR!" - p e.next #=> ["baz", :upcase], ["BAZ", :add_bang], "BAZ!" + e = a.lazy.map {|x| x.upcase }.map {|x| x + "!" }.eager + p e.class #=> Enumerator + p e.map {|x| x + "?" } #=> ["FOO!?", "BAR!?", "BAZ!?"] * Added Enumerator::Yielder#to_proc so that a Yielder object can be directly passed to another method as a block |