Ruby - Functional Patterns in Ruby
How do you correctly create a lazy enumerator from the array
[2, 4, 6] in Ruby?[2, 4, 6] in Ruby?.lazy method directly on Enumerable objects to create lazy enumerators.[2, 4, 6].lazy is the correct syntax.[2, 4, 6].to_enum.lazy is redundant but valid; however, to_enum returns an Enumerator, so chaining .lazy works but is unnecessary.LazyEnumerator.new([2, 4, 6]) is invalid as LazyEnumerator is not a Ruby class.[2, 4, 6].lazy_enum is invalid; no such method exists..lazy on the array [OK]15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions