From: Brian Candler Date: 2009-11-23T06:56:57+09:00 Subject: Re: confuse about initialize hash Zhenning Guan wrote: > Brian Candler wrote: > >> It is a special case: when the last argument to a method call is a hash, >> then you can omit the outer braces. > > > the hash options I saw in atom_feed , but it doesn't the last argument. Is it the &block that bothers you? That's another special bit of syntax. It allows you to capture the passed block into a variable. For example, def foo yield 123 end is pretty much the same as def foo(&blk) blk.call(123) end But in the second case, since the block itself is bound to a variable, you can in turn pass the block around to other methods. You might call foo like this: foo { |x| puts "The value is #{x}" } ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This is the 'block' I'm talking about So the block is a hidden argument which comes after all the other arguments, and unless you ask for it with &, it's entirely hidden. So the last *real* argument may be a hash without its outer braces. I hope that's a bit clearer :-) -- Posted via http://www.ruby-forum.com/.