Parent

Class/Module Index [+]

Quicksearch

RGen::TemplateLanguage::DirectoryTemplateContainer

Public Class Methods

new(metamodel=nil, output_path=nil, parent=nil) click to toggle source
# File lib/rgen/template_language/directory_template_container.rb, line 14
def initialize(metamodel=nil, output_path=nil, parent=nil)
  @containers = {}
  @directoryContainers = {}
  @parent = parent
  @metamodel = metamodel
  @output_path = output_path
end

Public Instance Methods

expand(template, *all_args) click to toggle source
# File lib/rgen/template_language/directory_template_container.rb, line 33
def expand(template, *all_args)
  if template =~ /^\//
    if @parent
      # pass to parent
      @parent.expand(template, *all_args)
    else
      # this is root
      _expand(template, *all_args)
    end
  elsif template =~ /^\.\.\/(.*)/
    if @parent
      # pass to parent
      @parent.expand($1, *all_args)
    else
      raise "No parent directory for root"
    end
  else
    _expand(template, *all_args)
  end
end
indentString() click to toggle source
# File lib/rgen/template_language/directory_template_container.rb, line 61
def indentString
  @indentString || (@parent && @parent.indentString) || "   "
end
indentString=(str) click to toggle source

Set indentation string. Every generated line will be prependend with n times this string at an indentation level of n. Defaults to " " (3 spaces)

# File lib/rgen/template_language/directory_template_container.rb, line 57
def indentString=(str)
  @indentString = str
end
load(dir) click to toggle source
# File lib/rgen/template_language/directory_template_container.rb, line 22
def load(dir)
  Dir.foreach(dir) { |f|
    qf = dir+"/"+f
    if !File.directory?(qf) && f =~ /^(.*)\.tpl$/
     (@containers[$1] = TemplateContainer.new(@metamodel, @output_path, self,qf)).load
    elsif File.directory?(qf) && f != "." && f != ".."
     (@directoryContainers[f] = DirectoryTemplateContainer.new(@metamodel, @output_path, self)).load(qf)
    end
  }
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.