Class: Eskimo::HTML::Html

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

Constant Summary

Constants inherited from Component

Component::ATTRIBUTE_REWRITES

Instance Attribute Summary

Attributes inherited from Component

#attributes, #children, #tag_name, #void

Instance Method Summary collapse

Methods inherited from Component

define!, tag

Constructor Details

#initialize(doctype: 'html') ⇒ Html

Returns a new instance of Html.



36
37
38
39
40
41
# File 'lib/eskimo/html.rb', line 36

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

Instance Method Details

#renderObject



43
44
45
46
47
48
49
# File 'lib/eskimo/html.rb', line 43

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