From: Power One Date: 2009-03-19T12:50:03+09:00 Subject: Re: Is this how you start a hash? This helps me a lot! :) Plus from now on, if something looks like an array but without the index (ex: options[3]), then I can safely assumed it's a form of hash but in a reading stage. Thank guys! lists wrote: > On Mar 18, 2009, at 7:50 PM, Power One wrote: > >> attr_reader :name >> >> >> > Yes, you'd normally create a new has with either Hash.new or hash = > {}. The method above is expecting that an already populated Hash be > passed as its argument (internally referred to as the options > variable). So here's how you'd use the Bot class: > > Bot.new(:name => 'My Bot', :data_file => '/tmp/file.yml') > > Maybe this helps you see the Hash more clearly: > > Bot.new({:name => 'My Bot', :data_file => '/tmp/file.yml'}) > > or even: > > my_options = {:name => 'My Bot', :data_file => '/tmp/file.yml'} > Bot.new(my_options) > > Hope this helps. -- Posted via http://www.ruby-forum.com/.