Skip to content

Instantly share code, notes, and snippets.

@cheeyeo
Created November 2, 2010 11:26
Show Gist options
  • Save cheeyeo/659504 to your computer and use it in GitHub Desktop.
Save cheeyeo/659504 to your computer and use it in GitHub Desktop.
HTML subclass of Report class using Template pattern
class HTMLReport < Report
def output_start
puts('<html>')
end
def output_head
puts(' <head>')
puts(" <title>#{@title}</title>")
puts(' </head>')
end
def output_body_start
puts('<body>')
end
def output_line(line)
puts(" <p>#{line}</p>")
end
def output_body_end
puts('</body>')
end
def output_end
puts('</html>')
end
end
@html_reporter = HTMLReport.new
@html_reporter.output_report
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment