From: Robert Klemme Date: 2007-10-20T20:50:08+09:00 Subject: Re: hash map during the creation of a new class instance? On 20.10.2007 13:22, aidy.lewis@googlemail.com wrote: > Is it possible to use a hash map during the creation of a new class > instance? > > E.g. > > Test_Case_1.new(test = {:name => 'case_1'}) And what should this do? > If so, what would the syntax be in the class initialisation method > > > class Test_Case_1 > def initialize(test[:name]) ? As with every method you can this syntax for invoking methods: irb(main):001:0> def foo(h) h end => nil irb(main):002:0> foo(:name => "hello", :age => 22) => {:name=>"hello", :age=>22} It depends on what you want to do how you would implement initialize here. Kind regards robert