Class: HTML::Document
Instance Attribute Summary collapse
Attributes inherited from Element
#attributes, #elements
Instance Method Summary
collapse
Methods inherited from Element
#add_elements, #render, #rendered_attributes, #rendered_elements, #tag
Constructor Details
#initialize(*elements, header_elements: []) ⇒ Document
5
6
7
8
|
# File 'lib/ruby_html/elements/document.rb', line 5
def initialize(*elements, header_elements: [])
@elements = elements
@header_elements = .flatten
end
|
Instance Attribute Details
Returns the value of attribute header_elements.
3
4
5
|
# File 'lib/ruby_html/elements/document.rb', line 3
def
@header_elements
end
|
Instance Method Details
#add_attribute(arg) ⇒ Object
28
29
30
|
# File 'lib/ruby_html/elements/document.rb', line 28
def add_attribute(arg)
raise NotImplementedError
end
|
#closing_tag ⇒ Object
20
21
22
|
# File 'lib/ruby_html/elements/document.rb', line 20
def closing_tag
"</body></html>"
end
|
#opening_tag ⇒ Object
10
11
12
|
# File 'lib/ruby_html/elements/document.rb', line 10
def opening_tag
"<!DOCTYPE><html><head>#{}</head><body>"
end
|
#render_to_file(path) ⇒ Object
24
25
26
|
# File 'lib/ruby_html/elements/document.rb', line 24
def render_to_file(path)
File.open(path, "w") { |file| file.write(render) }
end
|
14
15
16
17
18
|
# File 'lib/ruby_html/elements/document.rb', line 14
def
.map do |element|
element.render
end.join("")
end
|