Skip to content

Instantly share code, notes, and snippets.

@nelhage
Created April 22, 2014 19:24
Show Gist options
  • Save nelhage/11191220 to your computer and use it in GitHub Desktop.
Save nelhage/11191220 to your computer and use it in GitHub Desktop.
class To
def initialize(object)
@object = object
end
def method_missing(method, *args)
@object.public_send("to_#{method}", *args)
end
end
class Object
def to
To.new(self)
end
end
puts 5.to.s
puts "13".to.i
puts :foo.to.proc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment