Class: Gen::Generator
Instance Method Summary collapse
- #generate ⇒ Object (also: #call)
-
#initialize(gen = nil, &blk) ⇒ Generator
constructor
A new instance of Generator.
Constructor Details
#initialize(gen = nil, &blk) ⇒ Generator
Returns a new instance of Generator.
3 4 5 |
# File 'lib/gen.rb', line 3 def initialize(gen = nil, &blk) @gen = gen || blk or raise "A proc or a block is required" end |
Instance Method Details
#generate ⇒ Object Also known as: call
7 8 9 |
# File 'lib/gen.rb', line 7 def generate @gen.call end |