Skip to content

Instantly share code, notes, and snippets.

@amatsuda
Created November 1, 2011 12:11
Show Gist options
  • Save amatsuda/1330397 to your computer and use it in GitHub Desktop.
Save amatsuda/1330397 to your computer and use it in GitHub Desktop.
A sample of Ruby's method_missing
require 'open-uri'
class Http
def self./(url)
open("http://#{url}").read
end
end
class String
def com
self + '.com'
end
end
def http
Http
end
def method_missing(meth, *args)
meth.to_s
end
# p http::/google.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment