Class: PhusionPassenger::ConsoleTextTemplate
- Defined in:
- lib/phusion_passenger/console_text_template.rb
Constant Summary collapse
- TEMPLATE_DIR =
"#{File.dirname(__FILE__)}/templates"
Instance Method Summary collapse
- #[]=(name, value) ⇒ Object
-
#initialize(input, options = {}) ⇒ ConsoleTextTemplate
constructor
A new instance of ConsoleTextTemplate.
- #result ⇒ Object
Constructor Details
#initialize(input, options = {}) ⇒ ConsoleTextTemplate
Returns a new instance of ConsoleTextTemplate.
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/phusion_passenger/console_text_template.rb', line 30 def initialize(input, = {}) @buffer = '' if input[:file] data = File.read("#{TEMPLATE_DIR}/#{input[:file]}.txt.erb") else data = input[:text] end @template = ERB.new((data), nil, nil, '@buffer') .each_pair do |name, value| self[name] = value end end |
Instance Method Details
#[]=(name, value) ⇒ Object
44 45 46 47 |
# File 'lib/phusion_passenger/console_text_template.rb', line 44 def []=(name, value) instance_variable_set("@#{name}".to_sym, value) return self end |
#result ⇒ Object
49 50 51 |
# File 'lib/phusion_passenger/console_text_template.rb', line 49 def result return @template.result(binding) end |