Class: Eclair::Element

Inherits:
Object
  • Object
show all
Extended by:
T::Helpers, T::Sig
Defined in:
lib/eclair/element.rb

Defined Under Namespace

Modules: Void Classes: DangerousUnescapedHtml

Constant Summary collapse

AttributeValue =
T.type_alias { T.any(T::Boolean, String) }
Attributes =
T.type_alias { T::Hash[Symbol, AttributeValue] }
ElementChild =
T.type_alias { T.any(Element, String, DangerousUnescapedHtml) }
Children =
T.type_alias { T.any(T.class_of(Void), T::Array[ElementChild]) }

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tag:, attributes:, children:) ⇒ Element

Returns a new instance of Element.



48
49
50
51
52
# File 'lib/eclair/element.rb', line 48

def initialize(tag:, attributes:, children:)
  @tag = tag
  @attributes = attributes
  @children = children
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



40
41
42
# File 'lib/eclair/element.rb', line 40

def attributes
  @attributes
end

#childrenObject (readonly)

Returns the value of attribute children.



43
44
45
# File 'lib/eclair/element.rb', line 43

def children
  @children
end

#tagObject (readonly)

Returns the value of attribute tag.



37
38
39
# File 'lib/eclair/element.rb', line 37

def tag
  @tag
end