ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> ruby-talk
ruby-talk
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

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved