class Slideshow::Service::LiquidTemplate
use our own litter liquid template handler
works like "original" in pakman template manager used by slideshow
Public Class Methods
from_file( path )
click to toggle source
# File lib/slideshow/service.rb, line 191 def self.from_file( path ) puts " Loading template (from file) >#{path}<..." text = File.read_utf8( path ) ## use/todo: use read utf8 - why? why not?? self.new( text, path: path ) ## note: pass along path as an option end
from_public( name )
click to toggle source
# File lib/slideshow/service.rb, line 197 def self.from_public( name ) path = "#{PUBLIC_FOLDER}/#{name}" puts " Loading template (from builtin public) >#{path}<..." self.from_file( path ) ## note: pass along path as an option end
new( text, opts={} )
click to toggle source
# File lib/slideshow/service.rb, line 203 def initialize( text, opts={} ) @template = Liquid::Template.parse( text ) # parses and compiles the template end
Public Instance Methods
render( hash )
click to toggle source
# File lib/slideshow/service.rb, line 207 def render( hash ) ## note: hash keys MUST be strings (not symbols) e.g. 'name' => 'Toby' ## pp hash @template.render( hash ) end