Class: Wings::View

Inherits:
Object show all
Defined in:
lib/wings/view.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs) ⇒ View

Returns a new instance of View.



7
8
9
10
11
12
13
14
15
16
17
18
# 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

Instance Attribute Details

#headersObject (readonly)

Returns the value of attribute headers.



5
6
7
# File 'lib/wings/view.rb', line 5

def headers
  @headers
end

#statusObject (readonly)

Returns the value of attribute status.



5
6
7
# File 'lib/wings/view.rb', line 5

def status
  @status
end

#textObject (readonly)

Returns the value of attribute text.



5
6
7
# File 'lib/wings/view.rb', line 5

def text
  @text
end