Skip to content

Instantly share code, notes, and snippets.

@steveclarke
Created April 14, 2012 04:08
Show Gist options
  • Save steveclarke/2382060 to your computer and use it in GitHub Desktop.
Save steveclarke/2382060 to your computer and use it in GitHub Desktop.
class Banner
def initialize(&block)
@lines = []
instance_eval &block
end
def line(str)
@lines << str
end
def draw
puts "=" * 20
puts @lines.join("\n")
puts "=" * 20
end
end
banner = Banner.new do
line "foo"
line "bar"
end
banner.draw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment