Class: HTML::Tag
- Inherits:
-
Object
- Object
- HTML::Tag
- Defined in:
- lib/html/tag.rb
Instance Method Summary collapse
-
#initialize(tag, content) ⇒ Tag
constructor
A new instance of Tag.
- #to_html ⇒ Object
Constructor Details
#initialize(tag, content) ⇒ Tag
Returns a new instance of Tag.
3 4 5 6 |
# File 'lib/html/tag.rb', line 3 def initialize(tag, content) @tag = tag @content = content end |
Instance Method Details
#to_html ⇒ Object
8 9 10 11 |
# File 'lib/html/tag.rb', line 8 def to_html content = [*@content].map(&:to_s).join "<#{@tag}>#{content}</#{@tag}>" end |