Hi,

i spent a little time with the problem i had some time ago, in effect there is 
a problem with bindings mechanism in MacRuby 0.6 :

- create a new MacRuby Document based project 

- MyDocument.nib
        create a new ObjectController binded with File's Owner Content, model 
key path "dummy"
        create a new text field binded with ObjectController selection, model 
key path "name"

- MyDocument.rb

class MyDocument < NSDocument
        attr_accessor :dummy
        
        def init
                super
        
                setDummy({"name"=>"dummy"})
                puts "in init class of Hash is : #...@dummy.class.ancestors}"

                return self
        end
        
        def windowNibName
                'MyDocument'
        end
        
        # Document data representation for saving (return NSData)
        def dataOfType(type, error:outError)
                puts "in save class of Hash is : #...@dummy.class.ancestors}"
        
                return true
        end

        # Read document from data (return non-nil on success)
        def readFromData(data, ofType:type, error:outError)
                return true
        end

        # Return lowercase 'untitled', to comply with HIG
        def displayName
                fileURL ? super : super.sub(/^[[:upper:]]/) {|s| s.downcase}
        end
end

bindings works, but when i try to save the document...

in init class of Hash is : [Hash, NSMutableDictionary, NSDictionary, 
Enumerable, NSObject, Kernel]
in save class of Hash is : [#<Class:0x200577420>, Hash, NSMutableDictionary, 
NSDictionary, Enumerable, NSObject, Kernel]

of course if i try to serialize the object i obtain :

`fileWrapperOfType:error:': can't dump anonymous class #<Class:..........> 
(TypeError)

if i remove the bindings with text field all works again...well i mean no data 
in it, but at least the class of object remain the same

au contraire in MacRuby 0.5 all works fine

in init class of Hash is : [NSMutableDictionary, NSDictionary, Enumerable, 
NSObject, Kernel]
in save class of Hash is : [NSMutableDictionary, NSDictionary, Enumerable, 
NSObject, Kernel]

Thanks for any help and workaround
Ciao

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

Reply via email to