class Pakman::ErbTemplate

Public Class Methods

from_file( path ) click to toggle source
# File lib/pakman/erb/template.rb, line 7
def self.from_file( path )
  ## todo/fix: update logutils - (auto-)add ("static") logger helper/mixin too!!!!!
  LogKernel::Logger[ self ].info "  Loading template (from file) >#{path}<..."
  text = File.open( path, 'r:bom|utf-8' ).read     ## note: assume utf8
  self.new( text, path: path )   ## note: pass along path as an option
end
from_string( text ) click to toggle source
# File lib/pakman/erb/template.rb, line 14
def self.from_string( text )  ### use parse as alias - why?? why not??
  self.new( text )
end
new( text, opts={} ) click to toggle source
# File lib/pakman/erb/template.rb, line 18
def initialize( text, opts={} )
  @template = ERB.new( text )
end

Public Instance Methods

render( binding ) click to toggle source
# File lib/pakman/erb/template.rb, line 22
def render( binding )
  @template.result( binding )
end