D
David Stokar
Hi everybody,
this is my first post and allready a nifty question ;-)
What I want:
Create a NAMED class at runtime. Adding functions is clear.
E.g. somthing like that: (ClassGenerator is an existing module)
module ClassGenerator
def self.generate_new_class ( Parent_Class_Name, Name )
def self.add_method( source )
end
somewhere else:
ClassGenerator::generate_new_class( Fixnum, MyInt );
ClassGenerator::MyInt.add_method( %{ def special_one
return 2
}%
)
Thanks,
David Stokar
this is my first post and allready a nifty question ;-)
What I want:
Create a NAMED class at runtime. Adding functions is clear.
E.g. somthing like that: (ClassGenerator is an existing module)
module ClassGenerator
def self.generate_new_class ( Parent_Class_Name, Name )
def self.add_method( source )
end
somewhere else:
ClassGenerator::generate_new_class( Fixnum, MyInt );
ClassGenerator::MyInt.add_method( %{ def special_one
return 2
}%
)
Thanks,
David Stokar