diff options
Diffstat (limited to 'mrbgems/mruby-enum-lazy')
| -rw-r--r-- | mrbgems/mruby-enum-lazy/mrblib/lazy.rb | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/mrbgems/mruby-enum-lazy/mrblib/lazy.rb b/mrbgems/mruby-enum-lazy/mrblib/lazy.rb index 2ffeb1808..a31e89d0e 100644 --- a/mrbgems/mruby-enum-lazy/mrblib/lazy.rb +++ b/mrbgems/mruby-enum-lazy/mrblib/lazy.rb @@ -1,30 +1,33 @@ -# = Enumerable#lazy implementation -# -# Enumerable#lazy returns an instance of Enumerable::Lazy. -# You can use it just like as normal Enumerable object, -# except these methods act as 'lazy': -# -# - map collect -# - select find_all -# - reject -# - grep -# - drop -# - drop_while -# - take_while -# - flat_map collect_concat -# - zip -# -# == Acknowledgements -# -# Based on https://github.com/yhara/enumerable-lazy -# Inspired by https://github.com/antimon2/enumerable_lz -# http://jp.rubyist.net/magazine/?0034-Enumerable_lz (ja) - module Enumerable + + # = Enumerable#lazy implementation + # + # Enumerable#lazy returns an instance of Enumerable::Lazy. + # You can use it just like as normal Enumerable object, + # except these methods act as 'lazy': + # + # - map collect + # - select find_all + # - reject + # - grep + # - drop + # - drop_while + # - take_while + # - flat_map collect_concat + # - zip + # + # @mrbgem mruby-enum-lazy def lazy Lazy.new(self) end + # == Acknowledgements + # + # Based on https://github.com/yhara/enumerable-lazy + # Inspired by https://github.com/antimon2/enumerable_lz + # http://jp.rubyist.net/magazine/?0034-Enumerable_lz (ja) + # + # @mrbgem mruby-enum-lazy class Lazy < Enumerator def initialize(obj, &block) super(){|yielder| |
