Created
April 14, 2011 21:03
-
-
Save chanian/920545 to your computer and use it in GitHub Desktop.
The most straight forward hello world example I could think of...
This file contains 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
class Foo | |
def self.foo(*args) | |
args.each { |arg| | |
print arg[arg.keys.first] | |
} | |
yield | |
end | |
end | |
puts Foo.foo({:beep => "hello"},{:word=>" "}){x={:word => "world"};Foo.foo({:word => "there"},{:word => " "}){{:hello =>{:there=>{:world =>x[:word]}}}}}[:hello][:there][:world] | |
# Or, more simply | |
puts Foo.foo({ | |
:beep => "hello" | |
}, { | |
:word => " " | |
}) { | |
x = { | |
:word => "world" | |
} | |
Foo.foo({ | |
:word => "there" | |
},{ | |
:word => " " | |
}) { | |
{ | |
:hello => { :there => { :world => x[:word] } } | |
} | |
} | |
}[:hello][:there][:world] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
"Ruby can be so easy on the eyes!"