Class: Gen::Generator

Inherits:
Object show all
Defined in:
lib/gen.rb

Instance Method Summary collapse

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

#generateObject Also known as: call



7
8
9
# File 'lib/gen.rb', line 7

def generate
  @gen.call
end