[MacRuby-devel] spotlight - MDItemRef
joshua.ballanco at apple.com
Wed Oct 28 02:48:44 PDT 2009
Not a dumb question at all, just one of those "Ruby-isms" that will
take some adjusting to if you're coming from a C/C++/Obj-C background.
In Ruby, Constants always start with a Capital letter. Therefore, all
of the kFooBarBaz constants from Cocoa get translated as KFooBarBaz.
Actually, that's got me thinking that we should maybe compile a list
of the "cultural" differences between Obj-C and Ruby. I tried to sort
of touch on it by pointing out Obj-C's tendency to CamelCase in place
of Ruby's under_case, but I'm sure we can think of more of these
On Oct 28, 2009, at 2:31 AM, Allison Newman wrote:
> I'm probably asking a really dumb question here - but I haven't used
> bridgesupport very much...
> Is there a reason why the constant in the example that fails starts
> with an upper case K, rather than keeping the lower case k given in
> the framework?
> On Wednesday, October 28, 2009, at 01:31AM, "Laurent Sansonetti" <lsansonetti at apple.com
> > wrote:
>> Hi Alan,
>> I'm afraid the MD* APIs haven't been covered by BridgeSupport yet, so
>> it may not be possible to call it directly from MacRuby at this
>> I would recommend to file a bug at http://bugreporter.apple.com so
>> that we can consider this for a future Mac OS X release, and to wrap
>> this C API into an Objective-C class that you can call from MacRuby
>> the meantime.
>> On Oct 27, 2009, at 5:13 PM, Alan Skipp wrote:
>>> Would anyone be able to give me a hint on how to get the following
>>> objective-c code working with macruby. The code uses spotlight to
>>> extract metadata from a file.
>>> MDItemRef inspectedRef =
>>> CFArrayRef attributeNames = MDItemCopyAttributeNames(inspectedRef);
>>> NSLog(@"%@", (NSArray*)attributeNames);
>>> I was hoping that including the 'CoreServices' framework would work,
>>> no joy.
>>>>> framework 'CoreServices'
>>> => true
>>>>> item = MDItemCreate(KCFAllocatorDefault, '/Users/alan/Desktop/
>>> NameError: uninitialized constant KCFAllocatorDefault
>>> from core:in `const_missing:'
>>> from (irb):2:in `<main>'
>>> from core:in `eval:'
>>> from core:in `evaluate:'
>>> Alan Skipp
>>> al_skipp at fastmail.fm
>>> http://www.fastmail.fm - IMAP accessible web-mail
>>> MacRuby-devel mailing list
>>> MacRuby-devel at lists.macosforge.org
>> MacRuby-devel mailing list
>> MacRuby-devel at lists.macosforge.org
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
More information about the MacRuby-devel