Class: Html::Tag
- Inherits:
-
Object
show all
- Defined in:
- lib/html/tag.rb
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_s ⇒ Object
9
10
11
|
# File 'lib/html/tag.rb', line 9
def to_s
"<#{tag_name}#{read_attributes}>#{value}</#{tag_name}>"
end
|