From: "vadivelan .K" Date: 2009-11-21T18:12:39+09:00 Subject: Re: confuse about initialize hash Zhenning Guan wrote: > def in(options ={} ) > p options > end > > in(:say => "somehting") # {:say => "something"} > > but under the hood of it, doesn't that process equivalent to > ------- > options = {} > options = :say => "something" > ------- > or > ------ > options = :say => "something" > ------ > ??? none of this can compiler. > silly question, hope someone help. Hey Zhenning Guan, Hope the following sample will help you, def in(options) p options.class end in(:say => 'some_value') the type of argument passed to any method resembles inside the method, if you send hash it shows the class as 'Hash'. No need to initialize hash or anything in ruby script. It will assign automatically according to the values. thanks, vaddi -- Posted via http://www.ruby-forum.com/.