Note that yhara's version is obsolete. You should use the one in my backports
gem. It passes MRI's test for lazy
:
require 'backports/2.0.0/enumerable/lazy'
(1..42).lazy... # => works in all Rubies
Simply use a condition like Enumerable.method_defined?(:lazy)
to know if you should define it or not (like I do in backports
)