Class: RandomSet::CustomGenerator Private
- Inherits:
-
Object
- Object
- RandomSet::CustomGenerator
- Defined in:
- lib/random_set/template.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary collapse
- #block ⇒ Object readonly private
Instance Method Summary collapse
-
#initialize(block) ⇒ CustomGenerator
constructor
private
A new instance of CustomGenerator.
- #next ⇒ Object private
Constructor Details
#initialize(block) ⇒ CustomGenerator
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of CustomGenerator.
92 93 94 95 |
# File 'lib/random_set/template.rb', line 92 def initialize(block) @block = block @iteration = 0 end |
Instance Attribute Details
#block ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
97 98 99 |
# File 'lib/random_set/template.rb', line 97 def block @block end |
Instance Method Details
#next ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
99 100 101 102 103 104 105 106 107 |
# File 'lib/random_set/template.rb', line 99 def next if block.arity == 1 block.call @iteration else block.call end ensure @iteration += 1 end |