From: Brian Candler Date: 2011-09-29T18:00:43+09:00 Subject: Re: What does "exit_on_fail("initialize") { hook('preinit') { preinit } } " mean? Yunfeng Xu wrote in post #1024181: > I can't understand why "exit_on_fail("initialize") { hook('preinit') { > preinit } } " can be part of a statement together. I looked through some > ruby books, but found no answer. Read a section about 'blocks'. e.g. http://www.ruby-doc.org/docs/ProgrammingRuby/html/tut_containers.html#S2 Here you're not passing a block to be iterated (called multiple times), but something to be called later on. class Foo def prepare(&blk) puts "I got a block! I'm going to run it later" @my_block = blk end def doit @my_block.call end end f = Foo.new f.prepare { puts "Goodbye cruel world" } puts "OK it's stored" f.doit -- Posted via http://www.ruby-forum.com/.