Method: XRay::HTML::Element#initialize

Defined in:
lib/html/struct.rb

#initialize(tag, props = [], children = [], close_type = :after, ending = nil) ⇒ Element

Returns a new instance of Element.



20
21
22
23
24
25
# File 'lib/html/struct.rb', line 20

def initialize(tag, props=[], children=[], close_type=:after, ending=nil)
  @tag, @props, @children, @close_type, @ending = tag, to_props(props), Array.[](children).flatten || [], close_type, ending
  @position = @tag.position.dup if tag.is_a?(Node) and tag.position
  @children.each { |el| el.parent = self }
  @scopes = []
end