class SimpleHtml::Tag
Public Class Methods
new(name, content, attributes = {})
click to toggle source
# File lib/simple_html.rb, line 5 def initialize(name, content, attributes = {}) @name = name @content = content @attributes = attributes end
Public Instance Methods
to_html()
click to toggle source
# File lib/simple_html.rb, line 11 def to_html attributes = @attributes.sort_by(&:first). map { |key, value| " #{key}=\"#{value}\"" }. join "<#{@name}#{attributes}>#{@content}</#{@name}>" end