[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-talk
Subject:    Re: Is better to subclass or to add methods to an existing class?
From:       "Christoph" <chr_news () gmx ! net>
Date:       2002-09-19 20:41:58
[Download RAW message or body]


"Paul Brannan" wrote in
....
> You can also create an anonymous subclass:
>
>   class Foo
>     @@my_string = Class.new(String)
>   end

Anonymous subclasses are pain to work with btw.
- because of scoping problems you often have to
use the evil string eval ...

---
Beast = self
(@temptation = Class.new String).class_eval <<-Body
Beast = self
def six_six_six; Beast end
Body
---

/Christoph


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic