Class: Antelope::Generator::Output

Inherits:
Antelope::Generator show all
Defined in:
lib/antelope/generator/output.rb

Overview

Generates an output file, mainly for debugging. Included always as a generator for a grammar.

Instance Attribute Summary

Attributes inherited from Antelope::Generator

#file, #grammar, #mods

Instance Method Summary collapse

Methods inherited from Antelope::Generator

source_root, #template

Constructor Details

#initializeOutput

Defines singleton method for every mod that the grammar passed to the generator.



14
15
16
17
18
19
# File 'lib/antelope/generator/output.rb', line 14

def initialize(*)
  super
  mods.each do |k, v|
    define_singleton_method (k) { v }
  end
end

Instance Method Details

#generatevoid

This method returns an undefined value.

Actually performs the generation. Uses the template in output.erb, and generates the file <file>.output.



25
26
27
# File 'lib/antelope/generator/output.rb', line 25

def generate
  template "output.erb", "#{file}.output"
end