Class: RandomSet::Template::CustomGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/random_set/template.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(block) ⇒ CustomGenerator

Returns a new instance of CustomGenerator.



77
78
79
80
# File 'lib/random_set/template.rb', line 77

def initialize(block)
  @block = block
  @iteration = 0
end

Instance Attribute Details

#blockObject (readonly)



82
83
84
# File 'lib/random_set/template.rb', line 82

def block
  @block
end

Instance Method Details

#nextObject



84
85
86
87
88
# File 'lib/random_set/template.rb', line 84

def next
  block.call @iteration
ensure
  @iteration += 1
end