Parent

Class/Module Index [+]

Quicksearch

RGen::TemplateLanguage::TemplateContainer

Public Class Methods

const_missing(name) click to toggle source
# File lib/rgen/template_language/template_container.rb, line 64
def self.const_missing(name)
  super unless @@metamodels
  @@metamodels.each do |mm|
    return mm.const_get(name) rescue NameError
  end
  super
end
new(metamodels, output_path, parent, filename) click to toggle source
# File lib/rgen/template_language/template_container.rb, line 16
def initialize(metamodels, output_path, parent, filename)
  @templates = {}
  @parent = parent
  @filename = filename
  @indent = 0
  @output_path = output_path
          @metamodels = metamodels
          @metamodels = [ @metamodels ] unless @metamodels.is_a?(Array)
end

Public Instance Methods

evaluate(template, *all_args) click to toggle source
# File lib/rgen/template_language/template_container.rb, line 50
def evaluate(template, *all_args)
  args, params = _splitArgsAndOptions(all_args)
  raise StandardError.new(":foreach can not be used with evaluate") if params[:foreach]
  _expand(template, args, params.merge({:_evalOnly => true}))
end
expand(template, *all_args) click to toggle source
# File lib/rgen/template_language/template_container.rb, line 39
def expand(template, *all_args)
  args, params = _splitArgsAndOptions(all_args)
          if params.has_key?(:foreach)
          raise StandardError.new("expand :foreach argument is not enumerable")                          unless params[:foreach].is_a?(Enumerable)
    _expand_foreach(template, args, params)
  else
    _expand(template, args, params)
  end
end
load() click to toggle source
# File lib/rgen/template_language/template_container.rb, line 26
def load
          File.open(@filename,"rb") do |f|
    begin
               @@metamodels = @metamodels
             fileContent = f.read
           _detectNewLinePattern(fileContent)
                  ERB.new(fileContent,nil,nil,'@output').result(binding)
    rescue Exception => e
      processAndRaise(e)
    end
          end
end
method_missing(name, *args) click to toggle source
# File lib/rgen/template_language/template_container.rb, line 60
def method_missing(name, *args)
  @context.send(name, *args)
end
this() click to toggle source
# File lib/rgen/template_language/template_container.rb, line 56
def this
  @context
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.