Class: HTML::Tag

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

Instance Method Summary collapse

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_htmlObject



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

def to_html
  content = [*@content].map(&:to_s).join
  "<#{@tag}>#{content}</#{@tag}>"
end