Created
November 2, 2010 11:26
-
-
Save cheeyeo/659504 to your computer and use it in GitHub Desktop.
HTML subclass of Report class using Template pattern
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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