Sha256: 5af1c2ac758b16deaf581a1f11657b6f0d3794595bc5c3ec3f57c0f481d6e7d5
Contents?: true
Size: 822 Bytes
Versions: 2
Compression:
Stored size: 822 Bytes
Contents
module Kontrol # This class renders an ERB template for a set of attributes, which # are accessible as instance variables. class Template include Helpers # Initialize this template with an ERB instance. def initialize(app, vars) @__app__ = app vars.each do |k, v| instance_variable_set "@#{k}", v end end def __binding__ binding end def self.render(erb, app, file, vars) template = Template.new(app, vars) return erb.result(template.__binding__) rescue => e e.backtrace.each do |s| s.gsub!('(erb)', file) end raise e end def method_missing(id, *args, &block) if @__app__.respond_to?(id) return @__app__.send(id, *args, &block) end super end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
georgi-kontrol-0.3 | lib/kontrol/template.rb |
kontrol-0.3 | lib/kontrol/template.rb |