On Wed, Apr 2, 2008 at 11:18 AM, Martin Boese <boesemar / gmx.de> wrote:
> Is it possible to create classes with a dynamic name? Example:
>
>  name = "Test"
>
>  class name              # this fails
>   def write
>     puts "TEST"
>   end
>  end
>
>  puts Object::const_get(name).new.write          # => "TEST"
>
>
>
sure

c = Class::new {
  def a; 41 end
}
d = Class::new(c) {
  def a; super.succ end
}
d.new.a --> 42

HTH
Robert


-- 
http://ruby-smalltalk.blogspot.com/

---
Whereof one cannot speak, thereof one must be silent.
Ludwig Wittgenstein