Class: PhusionPassenger::ConsoleTextTemplate

Inherits:
Object
  • Object
show all
Defined in:
lib/phusion_passenger/console_text_template.rb

Constant Summary collapse

TEMPLATE_DIR =
"#{File.dirname(__FILE__)}/templates"

Instance Method Summary collapse

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, options = {})
	@buffer = ''
	if input[:file]
		data = File.read("#{TEMPLATE_DIR}/#{input[:file]}.txt.erb")
	else
		data = input[:text]
	end
	@template = ERB.new(substitute_color_tags(data),
		nil, nil, '@buffer')
	options.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

#resultObject



49
50
51
# File 'lib/phusion_passenger/console_text_template.rb', line 49

def result
	return @template.result(binding)
end