Yes, that's what I was suspecting and the "self." prefix was exactly what I was missing :) (And I just noticed "YES" is not available in MacRuby.)
The following works then:
def self.autosavesInPlace
return true
end
Thanks,
Sven
On Oct 8, 2011, at 17:36, Keith Gautreaux wrote:
> I'm not a Macruby expert and I don't know anything about Cocoa,
> particularly as it relates to new Lion features such as autosave, but
> the example code you gave is defining an instance method, not a class
> method.
>
> To override a class method you would need to do something like:
>
> class MyDocument < NSPersistentDocument
>
> ...
>
> def self.autosavesInPlace
> return YES
> end
> end
>
> There are other ways of defining class methods but this is the easiest
> when you just have one method.
>
> HTH
>
> On Sat, Oct 8, 2011 at 10:25 AM, Sven A. Schmidt <[email protected]> wrote:
>> Hi all,
>>
>> I'm trying to add autosave and versions to an application and as far as I
>> can tell from the docs it should be as simple as overriding
>> +(BOOL)autosavesInPlace to return YES from my core data document
>> application. So what I have is essentially:
>>
>> class MyDocument < NSPersistentDocument
>>
>> ...
>>
>> def autosavesInPlace
>> return YES
>> end
>>
>> end
>>
>> However, I don't get autosave or versions behavior (i.e. I've still got the
>> "dirty dot", no versions menu in the title bar etc). Also, autosavesInPlace
>> doesn't seem to get called. When I print a log message in there it never
>> shows up in the console.
>>
>> Should this be working the way I'm doing it? Unfortunately, I don't have a
>> Cocoa application to compare (yet) so I'm not sure if I'm doing something
>> wrong at the frameworks end or on the MacRuby side.
>>
>> One thing I was wondering (since I'm rather new to both Ruby and MacRuby):
>> I'm overriding a class method here (+(BOOL), not -(BOOL)), is there anything
>> special I need to consider when doing this from MacRuby?
>>
>> Cheers,
>> Sven
>>
>>
>> _______________________________________________
>> MacRuby-devel mailing list
>> [email protected]
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>
>>
>
>
>
> --
> Keith
> _______________________________________________
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
--
Dr. Sven A. Schmidt
abstracture GmbH & Co. KG
Wilhelm-Theodor-Römheld-Straße 28
55130 Mainz
Fon +49 6131 696 29 0
Fax +49 6131 696 29 29
Mail [email protected]
Amtsgericht Mainz HRA 40625
USt-IdNr.: DE258454694
Persönlich haftender Gesellschafter:
abstracture IT-Beratungs- und Beteiligungsgesellschaft mbH, Sitz Mainz,
Amtsgericht Mainz HRB 41357
Geschäftsführer: Dr. U. Koch, T. Meyer, A. Misok, Dr. S.A. Schmidt, Dr. V.
Schönharting
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
