[Rubycocoa-devel 617] Re: bit fields / ary + class methods overriding

Back to archive index

Eloy Duran eloy.****@gmail*****
Tue Jan 16 18:13:03 JST 2007


> > Second, it is now finally possible to override class methods from
> > Ruby!
> >
> > $ irb -r osx/foundation
> >>> include OSX
> > => Object
> >>> class Foo < NSObject
> >>>   def self.version
> >>>     42
> >>>   end
> >>> end
> > => nil
> >>> Foo.oc_version
> > => 42
> >
> > It's only available via subclassing though. I didn't updated
> > objc_export. I think that we should have a separate DSL method for
> > this.
> >
> > Like:
> >
> > class NSObject
> >    def self.myMethod
> >      42
> >    end
> >    objc_export_singleton :myMethod, 'int'
> > end
> >
> > We need a good name, and objc_export_singleton looks a bit long to me.
> > Any suggestion?
>
> mmmh, i should see this case when thinking about objc_export.
>
> i would prefer a bit objc_class_export rather than
> objc_export_singleton though almost no difference.

Laurent, question regarding the integrated rdoc.
This is what you meant a while ago about how you did this
with rubyosa right? As in, you extended the classes to contain their own data:
include CocoaRef
puts NSObject.rdoc.desc # => "A NSObject is blablablablabla....."

I think that to be able to do that we would need to be able to add
class methods to the
class itself not to a subclass or a singleton right?

eg:
class NSObject
   def self.rdoc
     return CocoaRef::ClassDef.new('NSObject')
   end
   objc_export :rdoc, 'id'
end

Eloy



More information about the Rubycocoa-devel mailing list
Back to archive index