Class: PhusionPassenger::HTMLTemplate
- Includes:
- ERB::Util
- Defined in:
- lib/phusion_passenger/html_template.rb
Overview
A convenience utility class for rendering our error pages.
Constant Summary collapse
- PASSENGER_FILE_PREFIX =
File.dirname(__FILE__)
- TEMPLATE_DIR =
"#{PASSENGER_FILE_PREFIX}/templates"
Instance Method Summary collapse
- #[]=(name, value) ⇒ Object
-
#initialize(template_name, options = {}) ⇒ HTMLTemplate
constructor
A new instance of HTMLTemplate.
- #result ⇒ Object
Constructor Details
#initialize(template_name, options = {}) ⇒ HTMLTemplate
Returns a new instance of HTMLTemplate.
33 34 35 36 37 38 39 40 |
# File 'lib/phusion_passenger/html_template.rb', line 33 def initialize(template_name, = {}) @buffer = '' @template = ERB.new(File.read("#{TEMPLATE_DIR}/#{template_name}.html.erb"), nil, nil, '@buffer') .each_pair do |name, value| self[name] = value end end |
Instance Method Details
#[]=(name, value) ⇒ Object
42 43 44 45 |
# File 'lib/phusion_passenger/html_template.rb', line 42 def []=(name, value) instance_variable_set("@#{name}".to_sym, value) return self end |
#result ⇒ Object
47 48 49 |
# File 'lib/phusion_passenger/html_template.rb', line 47 def result return @template.result(binding) end |