Hi,

What version are you using?
Since we rewrote the bridge between hash and dictionaries, it is possible that thing have changed since then.

However, with the latest trunk / nightlies, it should work. Here is what I get:

>> h = {}
=> {}
>> h.class
=> Hash
>> h.setObject 'foo', forKey:42
=> {42=>"foo"}

Let us know :-)

-- 
Thibault Martin-Lagardette



On Apr 10, 2010, at 18:12, Robert Love wrote:



I'm trying to learn Macruby and am using Apple's page as a guide:

http://developer.apple.com/mac/articles/scriptingautomation/cocoaappswithmacruby.html

I'm using macirb to follow the example and getting complete different answers.  Is the web page wrong?  Is Macruby wrong?  Am I doing something wrong?


irb(main):001:0> h = {}
=> {}
irb(main):002:0> h.class
=> NSMutableDictionary
irb(main):003:0> h.setObject 'foo', forKey:42
=> {1=>"foo"}
irb(main):004:0> 


Why isn't the key 42 like the Apple web page shows?

_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel