Skip to content

Instantly share code, notes, and snippets.

@steveclarke
Created April 6, 2012 18:18
Show Gist options
  • Save steveclarke/2321801 to your computer and use it in GitHub Desktop.
Save steveclarke/2321801 to your computer and use it in GitHub Desktop.
def banner
banner_text = "----------\n"
banner_text << yield
banner_text << "\n----------\n"
banner_text
end
banner_text = banner do
"foo"
"bar"
end
puts banner_text
# Outputs:
# ----------
# bar
# ----------
#
#
# How do I get it to output:
# ----------
# foo
# bar
# ----------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment