Class: RgGen::Core::OutputBase::CodeGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/rggen/core/output_base/code_generator.rb

Instance Method Summary collapse

Instance Method Details

#copyObject



17
18
19
20
21
# File 'lib/rggen/core/output_base/code_generator.rb', line 17

def copy
  generator = CodeGenerator.new
  generator.copy_code_blocks(@code_blocks) if @code_blocks
  generator
end

#generate(context, code, kind) ⇒ Object



11
12
13
14
15
# File 'lib/rggen/core/output_base/code_generator.rb', line 11

def generate(context, code, kind)
  code_blocks[kind].each do |block|
    execute_code_block(context, code, &block)
  end
end

#register(kind, &block) ⇒ Object



7
8
9
# File 'lib/rggen/core/output_base/code_generator.rb', line 7

def register(kind, &block)
  block_given? && (code_blocks[kind] << block)
end