Created
August 8, 2014 01:54
-
-
Save patmaddox/ba7ba511a412f28ace76 to your computer and use it in GitHub Desktop.
RubySteps 009 - OOP - Easty OOP (excerpt)
This file contains 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 StarWrapper | |
def initialize(stream) | |
@stream = stream | |
end | |
def puts(string) | |
print_header_line string | |
@stream.print "* " | |
@stream.print string | |
@stream.puts " *" | |
print_header_line string | |
end | |
def print_header_line(string) | |
(string.size + 4).times { @stream.print "*" } | |
@stream.puts | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment