Re: [MacRuby-devel] rubyfying Cocoa iterators

2011-11-16 Thread Mateus Armando
this should work, you can still use enumerateIndexesUsingBlock! framework 'Foundation' class NSIndexSet def each return self.to_enum unless block_given? self.enumerateIndexesUsingBlock -> idx, stop { yield idx } end end indexes = NSIndexSet.indexSetWithIndexesInRange NSMakeRange(0,

Re: [MacRuby-devel] Calling Foundation functions

2011-11-16 Thread Colin McPhail
Thank you! I promise to do a better search before I ask any more questions. On 16 Nov 2011, at 19:25, Mateus Armando wrote: > It’s a macro and I solved this problem like this: > > module Kernel > private > > def NSLocalizedString(key, value) > NSBundle.mainBundle.localizedStringForKey(

Re: [MacRuby-devel] rubyfying Cocoa iterators

2011-11-16 Thread Henry Maddocks
On 17/11/2011, at 4:07 AM, Daniel Westendorf wrote: > Give it some ruby love! I found this somewhere in the interwebs to iterate > over an NSIndexSet, which should be similar. https://gist.github.com/1370277 And while you're at it, check out Bean... https://github.com/dj2/Bean Lots more helpf

Re: [MacRuby-devel] Calling Foundation functions

2011-11-16 Thread Mateus Armando
It’s a macro and I solved this problem like this: module Kernel private def NSLocalizedString(key, value) NSBundle.mainBundle.localizedStringForKey(key, value:value, table:nil) end end this question has already been here: http://lists.macosforge.org/pipermail/macruby-devel/2011-Febr

Re: [MacRuby-devel] Calling Foundation functions

2011-11-16 Thread Colin McPhail
Hi Igor, You are right, NSLocalizedString is a macro. I never thought of that! Thank you. -- Colin On 16 Nov 2011, at 18:14, Игорь Владимирович Евсюков wrote: > Hi Colin, > > You have issues because NSLocalizedString isn't a C function, I'm not sure, > but I believe that it is preprocessor m

Re: [MacRuby-devel] Scripting OmniGraffle

2011-11-16 Thread Jordan K. Hubbard
This and many other great examples of "how to do FOO in MacRuby" lead me to wonder whether the wiki (or any wiki) is really being used to its fullest? Some real gems (no pun intended) have gone by, and it would be awesome for newcomers to have a place to go where they can explore a variety of

Re: [MacRuby-devel] Calling Foundation functions

2011-11-16 Thread Игорь Владимирович Евсюков
Hi Colin, You have issues because NSLocalizedString isn't a C function, I'm not sure, but I believe that it is preprocessor macros because it Xcode it highlight's as a macros: http://cl.ly/Bqw9 On Wed, Nov 16, 2011 at 7:39 PM, Colin McPhail wrote: > Hi, > > I'm having trouble calling the Foundat

[MacRuby-devel] Calling Foundation functions

2011-11-16 Thread Colin McPhail
Hi, I'm having trouble calling the Foundation function NSLocalizedString from within a method I have added to class NSRunningApplication: class NSRunningApplication def activeString active? ? NSLocalizedString("Yes", "Yes") : NSLocalizedString("No", "No") end end The error message I get

Re: [MacRuby-devel] symbol not found: _rb_str_freeze

2011-11-16 Thread Steve Clarke
Hi Jean-Denis, I can't answer your question directly but I may be able to help a bit. I also want to use mysql with `MacRuby. I tried mysql gem version 2.8.1 and hit problems I couldn't work around. I also tried ruby-mysql 2.9.4. I did get that to work after some mods, but it was very slow t

[MacRuby-devel] symbol not found: _rb_str_freeze

2011-11-16 Thread Jean-Denis MUYS
Hi, I have a big showstopper with my app: sequel with the mysql gem fails with the following error message: dyld: Symbol not found: _rb_str_freeze Referenced from: /Library/Frameworks/MacRuby.frameword/[…]/mysql_api.bundle This is mentioned on the net on the sequel project back in february. The

Re: [MacRuby-devel] rubyfying Cocoa iterators

2011-11-16 Thread Daniel Westendorf
Give it some ruby love! I found this somewhere in the interwebs to iterate over an NSIndexSet, which should be similar. https://gist.github.com/1370277 dw On Wed, Nov 16, 2011 at 3:11 AM, Jean-Denis MUYS wrote: > I have this ordered Core Data to-many relation named "operations" that I > want to

[MacRuby-devel] rubyfying Cocoa iterators

2011-11-16 Thread Jean-Denis MUYS
I have this ordered Core Data to-many relation named "operations" that I want to iterate over. I wrote: self.operations.each { | operation | operation.doSomething } However this fails because self.operations returns an NSOrderedSet and NSOrderedSet doesn't have an 'each' method. I was able