Class: PhusionPassenger::HTMLTemplate

Inherits:
Object
  • Object
show all
Includes:
ERB::Util
Defined in:
lib/phusion_passenger/html_template.rb

Overview

A convenience utility class for rendering our error pages.

Instance Method Summary collapse

Constructor Details

#initialize(template_name, options = {}) ⇒ HTMLTemplate

Returns a new instance of HTMLTemplate.



31
32
33
34
35
36
37
38
# File 'lib/phusion_passenger/html_template.rb', line 31

def initialize(template_name, options = {})
	@buffer = ''
	@template = ERB.new(File.read("#{TEMPLATES_DIR}/#{template_name}.html.erb"),
		nil, nil, '@buffer')
	options.each_pair do |name, value|
		self[name] = value
	end
end

Instance Method Details

#[]=(name, value) ⇒ Object



40
41
42
43
# File 'lib/phusion_passenger/html_template.rb', line 40

def []=(name, value)
	instance_variable_set("@#{name}".to_sym, value)
	return self
end

#resultObject



45
46
47
# File 'lib/phusion_passenger/html_template.rb', line 45

def result
	return @template.result(binding)
end