class Qwik::TemplateFactory

Public Class Methods

new(config) click to toggle source
# File vendor/qwik/lib/qwik/template.rb, line 11
def initialize(config)
  @config = config
  @template_path = config.template_dir.path
end

Public Instance Methods

check_template(cmd) click to toggle source
# File vendor/qwik/lib/qwik/template.rb, line 41
def check_template(cmd)
  file = @template_path+"#{cmd}.rb"
  return false if ! file.exist?
  require file
end
get(cmd) click to toggle source
# File vendor/qwik/lib/qwik/template.rb, line 16
def get(cmd)
  if @config.debug
    require 'qwik/template-generator'
    path = @config.template_dir.path
    TemplateGenerator.make(path, cmd)
  end

  method = "generate_#{cmd}"
  if defined?(Template) && Template.respond_to?(method)
    w = Template.send(method)
    patch(w)
    return w
  end

  if check_template(cmd)
    return get(cmd)
  end

  return nil
end
patch(w) click to toggle source
# File vendor/qwik/lib/qwik/template.rb, line 37
def patch(w)
  w[1].insert(1, {:'xmlns:v'=>'urn:schemas-microsoft-com:vml'})
end