From: Emmanuel Oga Date: 2007-09-26T07:09:26+09:00 Subject: Using a block to configure/initialize a class Hi! i need a solution for this, it's pretty simple but i can't get it to work... suppose: class Options def self.define_an_option # ...don't-know-how-implementation :( end define_an_option :option1, String define_an_option :option2, Array end Then, i want to do something like this: opt= Options.new opt.option1 => "" opt.option2 => [] opt.option1 do |o| o= "Hello" end opt.option2 do |o| o << 10 end options.option1 => "Hello" options.option2 => [10] Thats all! Seems pretty simple, but i tried with a lot of variants and I don't get it to work. Any ideas? Thanks! -- Posted via http://www.ruby-forum.com/.