--0016e64aeceeecb33b04ae0c2487
Content-Type: text/plain; charset=UTF-8

Hi,

I am a newbie for ruby,and not much familar with rube's grammar although I
promise I have read some ruby books. When I read puppet codes, I find the
following snippet:

# This is the main application entry point
def run
exit_on_fail("initialize") { hook('preinit') { preinit } }
exit_on_fail("parse options") { hook('parse_options') { parse_options } }
exit_on_fail("parse configuration file") { Puppet.settings.parse } if
should_parse_config?
exit_on_fail("prepare for execution") { hook('setup') { setup } }
exit_on_fail("configure routes from #{Puppet[:route_file]}") {
configure_indirector_routes }
exit_on_fail("run") { hook('run_command') { run_command } }
end

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.

I know that run(), exit_on_fail(), hook() and preinit are all the method of
the same class.

Thanks
Yunfeng

--0016e64aeceeecb33b04ae0c2487--