Class: Enumerator

Inherits:
Object
  • Object
show all
Defined in:
lib/tagen/core/enumerator.rb

Instance Method Summary collapse

Instance Method Details

#with_iobject(*args, &blk) ⇒ Object

Raises:

  • (ArgumentError)

See Also:

  • with_object


27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/tagen/core/enumerator.rb', line 27

def with_iobject(*args, &blk)
	return self.to_enum(:with_iobject, *args) unless blk

   (offset,), (memo,) = args.partition{|v| Fixnum === v}
   index = offset || 0
	raise ArgumentError, "must provide memo object" unless memo

	with_object(memo) do |args2, m|
		blk.call args2, index, m
     index += 1
	end
end