class Wings::View
Attributes
headers[R]
status[R]
text[R]
Public Class Methods
new(attrs)
click to toggle source
# File lib/wings/view.rb, line 7 def initialize(attrs) @env = attrs[:env] @headers = attrs[:headers] || {} @template = attrs[:template] @local_vars = attrs[:local_vars] || {} @controller = attrs[:controller] @instance_vars = attrs[:instance_vars] || {} @text = get_text @status = attrs[:status] || 200 @headers['Content-Type'] ||= 'text/html' end
Private Instance Methods
additional_variables()
click to toggle source
# File lib/wings/view.rb, line 28 def additional_variables Hash.new .merge(env: @env) .merge(@local_vars) .merge(@instance_vars) end
get_text()
click to toggle source
# File lib/wings/view.rb, line 22 def get_text template = File.read(File.join('app', 'views', @controller, "#{@template}.html.erb")) erb = Erubis::Eruby.new(template) erb.result additional_variables end