class PrettyDoc::Template

Base Template class

Attributes

dir[RW]

Public Class Methods

get(name) click to toggle source
# File lib/pretty_doc/template.rb, line 15
def get(name)
  @pool ||= {}
  @pool[name]
end
register(name, theme) click to toggle source
# File lib/pretty_doc/template.rb, line 10
def register(name, theme)
  @pool ||= {}
  @pool[name] = theme
end

Public Instance Methods

assets() click to toggle source
# File lib/pretty_doc/template.rb, line 25
def assets
  [Resource::Scss.new(dir)]
end
render(hash) click to toggle source
# File lib/pretty_doc/template.rb, line 29
def render(hash)
  erb_file = theme_file_pathname('template.html.erb')
  template = ERB.new(erb_file.read)

  @content = hash[:content]
  @title = hash[:title]
  template.result(binding)
end
theme_file_pathname(file) click to toggle source
# File lib/pretty_doc/template.rb, line 21
def theme_file_pathname(file)
  dir.join(file)
end
write_assets(dir) click to toggle source
# File lib/pretty_doc/template.rb, line 38
def write_assets(dir)
  assets.each do |asset|
    asset.write(dir)
  end
end