Class: Enumerator
Instance Method Summary collapse
-
#with_iobject(*args, &blk) ⇒ Object
combine with_index and with_object.
Instance Method Details
#with_iobject(*args) ⇒ Object #with_iobject(*args) {|(*args), idx, memo_obj| ... } ⇒ Object
combine with_index and with_object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/tagen/core/enumerator.rb', line 17 def with_iobject *args, &blk return self.to_enum(:with_iobject, *args) unless blk offset = args.find!{|v| Fixnum===v} || 0 raise ArgumentError "must provide memo_obj" if args.empty? memo = args[0] i = offset-1 self.with_object memo do |args, m| blk.call args,i+=1,m end end |