class Prow::Templates
Public Instance Methods
collection()
click to toggle source
# File lib/prow/templates.rb, line 25 def collection @collection ||= load end
layout(name='default')
click to toggle source
# File lib/prow/templates.rb, line 3 def layout(name='default') template('layouts', name) end
load()
click to toggle source
# File lib/prow/templates.rb, line 29 def load Dir.glob("#{path}/**/*.mustache").map do |template_path| Template.new(template_path, path) end end
page(name)
click to toggle source
# File lib/prow/templates.rb, line 7 def page(name) template('pages', name) end
partial(name)
click to toggle source
# File lib/prow/templates.rb, line 11 def partial(name) partials.detect {|t| t.name == name} end
partials()
click to toggle source
# File lib/prow/templates.rb, line 15 def partials collection.select {|template| template.type == 'partials' } end
template(type, name)
click to toggle source
# File lib/prow/templates.rb, line 19 def template(type, name) found = collection.detect { |template| template.type == type && template.name == name } raise ArgumentError.new("#{type} #{name} not found") unless found found end