class TableCloth::Ingredients

Public Instance Methods

to_html(*args) click to toggle source
# File lib/tablecloth/ingredient.rb, line 105
def to_html *args
  return String.new if self.empty?

  if(!args.empty?)
    raise ArgumentError if args.size > 1

    html_class = " class = '#{args.first[:class]}'" if args.first[:class]
    html_id = " id = '#{args.first[:id]}'" if args.first[:id]

  end
  
  html = "<ul#{html_id}#{html_class}>"
  
  self.each do |ingredient|
    html << "<li>#{ingredient.to_s}</li>"
  end      
  
  html << "</ul>"
end