From: Tobias Reif Date: 2001-09-21T04:02:32+09:00 Subject: [ruby-talk:21453] Re: chain methods inside and outside the class; how to intermingle mine and Strings' methods? Frykholm, Niklas wrote: > This is a bit weird. You should decide whether you want an object > that _contains_ a string (in an instance variable @s, for example) > or whether you want an object that _is a kind of_ string (a > subclass of a String). Currently you do both. > > What you want depends on what you are trying to model. If you want > to create something which basically is a string, but has some extra > convenience methods, you probably want a subclass of String. If you > want to create something which is not really a string, but has a > string (for example a bank account that has a string for account holder) > you would make a class that does not inherit from String and make the > account holder name an instance variable. > [...] >>question 2: how to make it possible to write: >>intermingled = h.upcase.repeat.chop # perhaps to_s Thanks a lot for your help :) One more question: How would I achieve it, when I choose to make the string an instance variable, to chain methods together? Perhaps this doesn't make sense anyways (?) Tobi -- Tobias Reif http://www.pinkjuice.com/myDigitalProfile.xhtml go_to('www.ruby-lang.org').get(ruby).play.create.have_fun http://www.pinkjuice.com/ruby/