Skip to content

Instantly share code, notes, and snippets.

@bnadlerjr
Created July 28, 2010 00:25
Show Gist options
  • Save bnadlerjr/493107 to your computer and use it in GitHub Desktop.
Save bnadlerjr/493107 to your computer and use it in GitHub Desktop.
def output(data, format)
case format
when :html
return "<p>#{data}</p>"
when :text
return data
when :pdf
return "<pdf>#{data}</pdf>" # pseudocode -- obviously not valid PDF output
else
raise ArgumentError, "Invalid format (#{format})."
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment