Class: ObjectView::Head
Instance Attribute Summary
Attributes inherited from Element
#acceptable_children, #children, #single_line, #tag
Instance Method Summary collapse
- #add_stylesheet(path, id = Time.new.to_i.to_s) ⇒ Object
- #add_title(title) ⇒ Object
-
#initialize ⇒ Head
constructor
A new instance of Head.
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
#initialize ⇒ Head
Returns a new instance of Head.
11 12 13 14 15 |
# File 'lib/object_view/head.rb', line 11 def initialize super @tag = "head" self.acceptable_children = [Javascript, JavascriptFile, Stylesheet, Title, String, Link] end |
Instance Method Details
#add_stylesheet(path, id = Time.new.to_i.to_s) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/object_view/head.rb', line 17 def add_stylesheet(path, id = Time.new.to_i.to_s) link = self.add Stylesheet.new link[:href] = path link[:id] = id link[:type] = 'text/css' link[:media] = 'screen' link[:rel] = 'stylesheet' return link end |