Satoshi Nakagawa
snaka****@infot*****
Sun Aug 26 11:14:09 JST 2007
I have added duck typing for NSArray and NSDictionary in r2009. Now NSArray and NSDictionary behave Array and Hash respectively. a = NSMutableArray.alloc.init a << 1 << 2 << 3 p a.map {|i| i.to_i*3 } #=> [3, 6, 9] dic = NSMutableDictionary.alloc.init dic[1] = 'one' dic[2] = 'two' h= { 3 => 'three', 4 => 'four'} dic.merge!(h) dic.each {|k,v| puts "#{k.to_i}: #{v.to_s}" } #=> 1: one 2: two 3: three 4: four -- Satoshi Nakagawa