Skip to content

Instantly share code, notes, and snippets.

@chanian
Created April 14, 2011 21:03
Show Gist options
  • Save chanian/920545 to your computer and use it in GitHub Desktop.
Save chanian/920545 to your computer and use it in GitHub Desktop.
The most straight forward hello world example I could think of...
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]
@chanian
Copy link
Author

chanian commented Jun 16, 2011

"Ruby can be so easy on the eyes!"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment