Skip to content

Instantly share code, notes, and snippets.

@jedschneider
Created December 6, 2010 03:21
Show Gist options
  • Select an option

  • Save jedschneider/729790 to your computer and use it in GitHub Desktop.

Select an option

Save jedschneider/729790 to your computer and use it in GitHub Desktop.
:hello + "world" rescue "say what?" #=> "say what?"
# so we can do the normal thing
:hello.to_s + "world" #=> "hello world"
"#{:hello} world" #=> "hello world"
# or we can have fun
class Symbol
def +(arg)
[to_s, arg].join(" ")
end
end
:hello + "world" #=> "hello world"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment