Skip to content

Instantly share code, notes, and snippets.

@offby1
Created June 7, 2012 01:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save offby1/2885980 to your computer and use it in GitHub Desktop.
Save offby1/2885980 to your computer and use it in GitHub Desktop.
class String
def my_method!(new)
self.clear
new.each_char { |c| self << c}
end
end
x = "frotz"
x.my_method!("whoa")
p x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment