Sha256: da0ded14ec61e119712ebcdd3d2ade1a3237d6c7302eb543fb2f685acd6d00e2

Contents?: true

Size: 727 Bytes

Versions: 6

Compression:

Stored size: 727 Bytes

Contents

# encoding: utf-8

require "pp"

module Antelope
  class Generator

    # Generates an output file, mainly for debugging.  Included always
    # as a generator for a grammar.
    class Output < Generator

      # Defines singleton method for every mod that the grammar passed
      # to the generator.
      #
      # @see Generator#initialize
      def initialize(*)
        super
        mods.each do |k, v|
          define_singleton_method (k) { v }
        end
      end

      # Actually performs the generation.  Uses the template in
      # output.erb, and generates the file `<file>.output`.
      #
      # @return [void]
      def generate
        template "output.erb", "#{file}.output"
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
antelope-0.1.7 lib/antelope/generator/output.rb
antelope-0.1.6 lib/antelope/generator/output.rb
antelope-0.1.5 lib/antelope/generator/output.rb
antelope-0.1.4 lib/antelope/generator/output.rb
antelope-0.1.3 lib/antelope/generator/output.rb
antelope-0.1.2 lib/antelope/generator/output.rb