Re: Anonymous classes?
by Ben Tilly other posts by this author
Oct 21 2007 3:08AM messages near this date
Re: Anonymous classes?
|
Re: Anonymous classes?
7stud -- wrote:
> Ben Tilly wrote:
> How about something like this:
>
> Dog = Class.new {
> def self.create_method(name, proc_)
> self.send(:define_method, name, proc_)
> end
> }
>
>
> p = lambda {puts "Woof, woof."}
> Dog.create_method(:bark, p)
>
> d = Dog.new
> d.bark
I tried this, but when I went with my inherited objects, I was not
picking up the IDs of the inherited objects correctly.
Cheers,
Ben
--
Posted via http://www.ruby-forum.com/.
Thread:
Ben Tilly
7stud --
Ben Tilly
Jimmy Kofler
Ben Tilly
Sebastian Hungerecker
Ezra Zygmuntowicz
Ben Tilly
|