class Schoolkeep::Template
Constants
- CSS_MIME
- HTML_MIME
Attributes
path[RW]
name[R]
Public Class Methods
new(name)
click to toggle source
# File lib/schoolkeep/template.rb, line 19 def initialize(name) @name = name @partial_loader = PartialLoader.new(self.class.path) end
Public Instance Methods
render(variables: {})
click to toggle source
# File lib/schoolkeep/template.rb, line 30 def render(variables: {}) template.render( variables: Fixture.for(name, overrides: variables) ) end
source()
click to toggle source
# File lib/schoolkeep/template.rb, line 24 def source @source ||= File.read( File.join(self.class.path, name) ) end
type()
click to toggle source
# File lib/schoolkeep/template.rb, line 36 def type @type ||= case name when /\.css\.sktl$/ CSS_MIME when /\.html\.sktl$/ HTML_MIME end end
Private Instance Methods
template()
click to toggle source
# File lib/schoolkeep/template.rb, line 47 def template @template ||= ::Scribble::Template.new( source, loader: @partial_loader ) end