Skip to content

Instantly share code, notes, and snippets.

@jedediah
Created August 19, 2009 18:06
Show Gist options
  • Save jedediah/170529 to your computer and use it in GitHub Desktop.
Save jedediah/170529 to your computer and use it in GitHub Desktop.
module AutoBang
def method_missing meth, *args, &block
if meth =~ /^(.*)!$/ and respond_to?(m = $1)
replace send(m, *args, &block)
else
super
end
end
end
[String,Array,Hash].each {|x| x.send :include, AutoBang }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment