From: ara.t.howard@... Date: 2006-04-25T12:17:13+09:00 Subject: [RCR] Hash#getopt at this point calls of the form some_method arg, "key" => "value" or some_method arg, :key=>:value are idiomatic ruby. let's just support it directly and be done with it: harp:~ > cat a.rb class ::Hash def getopt opt, default = nil keys = opt.respond_to?('each') ? opt : [opt] keys.each do |key, *ignored| return self[key] if self.has_key? key key = "#{ key }" return self[key] if self.has_key? key key = key.intern return self[key] if self.has_key? key end return default end end opts = {'k' => 42} p opts.getopt('k') p opts.getopt(:k) opts = {:k => 42} p opts.getopt('k') p opts.getopt(:k) opts = {'K' => 42} p opts.getopt('k', opts.getopt('K')) p opts.getopt(:k, opts.getopt(:K)) p opts.getopt(%w( k K )) opts = {:K => 42} p opts.getopt('k', opts.getopt('K')) p opts.getopt(:k, opts.getopt(:K)) p opts.getopt(%w( k K )) harp:~ > ruby a.rb 42 42 42 42 42 42 42 42 42 42 regards. -a -- be kind whenever possible... it is always possible. - h.h. the 14th dali lama