Class: Mayu::VDOM::DOM
- Inherits:
-
Object
- Object
- Mayu::VDOM::DOM
- Extended by:
- T::Sig
- Defined in:
- lib/mayu/vdom/dom.rb
Defined Under Namespace
Classes: CSSStyleDeclaration, Comment, DOMException, Element, Node, Text
Instance Attribute Summary collapse
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Instance Method Summary collapse
- #create_element(tag_name) ⇒ Object
- #create_text_node(data) ⇒ Object
-
#initialize ⇒ DOM
constructor
A new instance of DOM.
- #next_id! ⇒ Object
Constructor Details
#initialize ⇒ DOM
Returns a new instance of DOM.
220 221 222 223 |
# File 'lib/mayu/vdom/dom.rb', line 220 def initialize @id_counter = T.let(0, Integer) @root = T.let(create_element(:html), Element) end |
Instance Attribute Details
#root ⇒ Object (readonly)
Returns the value of attribute root.
217 218 219 |
# File 'lib/mayu/vdom/dom.rb', line 217 def root @root end |
Instance Method Details
#create_element(tag_name) ⇒ Object
226 227 228 |
# File 'lib/mayu/vdom/dom.rb', line 226 def create_element(tag_name) Element.new(self, tag_name) end |
#create_text_node(data) ⇒ Object
231 232 233 |
# File 'lib/mayu/vdom/dom.rb', line 231 def create_text_node(data) Text.new(self, data) end |
#next_id! ⇒ Object
236 |
# File 'lib/mayu/vdom/dom.rb', line 236 def next_id! = @id_counter += 1 |