Class: Eskimo::HTML::Html

Inherits:
Component show all
Defined in:
gems/eskimo-html/lib/eskimo/html/components/html.rb

Constant Summary

Constants inherited from Component

Component::ATTRIBUTE_REWRITES

Instance Attribute Summary

Attributes inherited from Component

#attributes, #children, #tag_name

Instance Method Summary collapse

Constructor Details

#initialize(doctype: 'html') ⇒ Html

Returns a new instance of Html



5
6
7
8
9
10
# File 'gems/eskimo-html/lib/eskimo/html/components/html.rb', line 5

def initialize(doctype: 'html', **)
  @doctype = doctype
  @tag_name = 'html'
  super
  @attributes.delete(:doctype)
end

Instance Method Details

#renderObject



12
13
14
15
16
17
18
# File 'gems/eskimo-html/lib/eskimo/html/components/html.rb', line 12

def render(**)
  if @doctype.to_s.empty?
    super
  else
    "<!DOCTYPE #{@doctype}>\n" + super
  end
end