Class: Html::Tag

Inherits:
Object
  • Object
show all
Defined in:
lib/html/tag.rb

Direct Known Subclasses

Col, Row, Table, Tbody, Thead

Instance Method Summary collapse

Constructor Details

#initialize(**attrs) ⇒ Tag

Returns a new instance of Tag.



5
6
7
# File 'lib/html/tag.rb', line 5

def initialize(**attrs)
  @attributes = attrs
end

Instance Method Details

#attributes=(new_attributes) ⇒ Object



13
14
15
# File 'lib/html/tag.rb', line 13

def attributes=(new_attributes)
  @attributes.merge!(new_attributes).compact!
end

#to_sObject



9
10
11
# File 'lib/html/tag.rb', line 9

def to_s
  "<#{tag_name}#{read_attributes}>#{value}</#{tag_name}>"
end