Class: ObjectView::Page

Inherits:
Element
  • Object
show all
Defined in:
lib/object_view/page.rb

Instance Attribute Summary collapse

Attributes inherited from Element

#acceptable_children, #children, #single_line, #tag

Instance Method Summary collapse

Methods inherited from Element

#<<, #add, #add_with_tag, #attr, #attributes, #css_class=, #find_element_with_tag, #id=, #is_acceptable_child?, #on_click=, #render, #render_attributes, #render_children, #style, #style=

Constructor Details

#initializePage

Returns a new instance of Page.



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/object_view/page.rb', line 21

def initialize
  super
  self.tag = "html"
  @head = Head.new
  self.add @head
  @body = Body.new
  self.add @body
  @top_div = nil
  @title_div = nil
  @title = nil
  @acceptable_children = [Head, Body]
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



19
20
21
# File 'lib/object_view/page.rb', line 19

def body
  @body
end

#headObject

Returns the value of attribute head.



19
20
21
# File 'lib/object_view/page.rb', line 19

def head
  @head
end

#titleObject

Returns the value of attribute title.



19
20
21
# File 'lib/object_view/page.rb', line 19

def title
  @title
end

#title_divObject

Returns the value of attribute title_div.



19
20
21
# File 'lib/object_view/page.rb', line 19

def title_div
  @title_div
end

#top_divObject

Returns the value of attribute top_div.



19
20
21
# File 'lib/object_view/page.rb', line 19

def top_div
  @top_div
end

Instance Method Details

#displayed_title=(title) ⇒ Object



34
35
36
37
38
# File 'lib/object_view/page.rb', line 34

def displayed_title=(title)
  @top_div = self.body.add Div.new
  @title_div = self.body.add Div.new
  self.title_div.add(Header.new(1, title))
end