[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Using a result as a constant object?

Phy Prabab

10/19/2008 6:21:00 PM

Brian,

Ah, I see now (said the blind man)! This cool! Thanks for the example, much appreciated!

Cheers,
Phy


--- On Sun, 10/19/08, Brian Candler <b.candler@pobox.com> wrote:

> From: Brian Candler <b.candler@pobox.com>
> Subject: Re: Using a result as a constant object?
> To: "ruby-talk ML" <ruby-talk@ruby-lang.org>
> Date: Sunday, October 19, 2008, 1:03 PM
> Phy Prabab wrote:
> > I am trying to understand how I can use a return from
> a method as a
> > constant name for a class.
>
> def get_name
> "Foo"
> end
>
> n = get_name
> c = Class.new(ActiveRecord::Base) # superclass
> Object.const_set(n, c)
> --
> Posted via http://www.ruby-....

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail...