[Nitro] RDOG 0.2 (or something like that)

George Moschovitis george.moschovitis at gmail.com
Wed Sep 7 01:48:12 EDT 2005


:-) ok...

-g.

On 9/6/05, Andrew Thompson <vagabond at cataclysm-software.net> wrote:
> You've asked me this about 3 times now George, I'll paste my testcase
> AGAIN, maybe this time you'll keep it somewhere handy :). I just want to
> have Classes and Methods both able to store Method objects...
> 
> Vag
> 
> 
> ============================
> 
> require 'rubygems'
> require_gem 'og'
> 
> #turn on debugging
> $DBG = true
> 
> class Doc
>      property :name, String
> 
>      def initialize(name)
>          @name = name
>      end
> end
> 
> class DocModule < Doc
>      has_many :functions, DocMethod #contains many methods
> end
> 
> class DocClass < DocModule
>      many_to_many :modules, DocModule #may have many modules, and those
> modules may be in other classes
> end
> 
> class DocMethod < Doc
>      belongs_to :parent, DocModule #belong to a DocModule as DocClass is
> a subclass of DocModule
> end
> 
> db = Og.setup(
>        :store => 'mysql',
>        :name => 'test',
>        :user => 'bleh',
>        :password => 'something'
> )
> 
> testclass = DocClass.new('Testd')
> testmethod = DocMethod.new('test')
> testmodule = DocModule.new('module')
> 
> testmethod.parent = testclass
> 
> #save the objects
> 
> testclass.save
> testmethod.save
> 
> #this works
> testmethod.parent = testclass
> 
> #but reports no parents...
> puts testmethod.parent
> 
> #this causes a crash
> #testclass.add_function(testmethod)
> 
> #this causes a crash
> #puts testclass.functions
> 
> ===============================
> 
> George Moschovitis wrote:
> >>(og still doesn't seem to want to play nice with inherited classes),
> >
> >
> > what is the problem exactly?
> >
> > -g.
> >
> >
> >
> 
> _______________________________________________
> Nitro-general mailing list
> Nitro-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/nitro-general
> 


-- 
http://www.gmosx.com
http://www.navel.gr
http://www.nitrohq.com




More information about the Nitro-general mailing list