Created
October 20, 2009 20:15
-
-
Save brianm/214573 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
class Magic | |
def initialize parents=nil, name=nil, args=nil | |
@args, @path = args, if parents then | |
"#{parents}.#{name}" | |
else | |
name | |
end | |
end | |
def method_missing name, *args | |
Magic.new @path, name, args | |
end | |
def to_s | |
"#{@path}#{ @args.inspect if @args }" | |
end | |
end | |
if __FILE__ == $0 then | |
a = Magic.new | |
puts a.hello.world.nice(:a => 7, "b" => "hello") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment