From: Ralph Grothe Date: 2007-07-24T21:26:05+09:00 Subject: Ruby Basics Hello, I successfully compiled and installed Ruby and Gems on this HP-UX box (see my other thread). Yesterday, I bought a copy of the Ruby equivalent to the Perl Camel Book (n.b. I am coming from Perl), viz. the PickAxe Book, and read the first couple of chapters while toying parallel a little bit at the irb> That's where my first question arose. Being used to the Perl debugger for similar experiments like with irb, the former at least offers, albeit moderate, history amenities (viz. !cmd#, to repeat cmd No. #) I would have expected irb to offer some readline and thus command history support (I am a lousy typer)? Then while reading the code examples in the PickAxe I was a little bewildered how the authors were merrily extending their sample classes by simply redifinig some method to add functionality without, as I would have expected, first sublassing the class and then overriding single methods. Instead it went like this E.g. class Noise def moo # some implementation end end # more paragraphs of text # and then taking up again class Noise def moo # deviating implementation from first definition end end # and so forth I this valid (and recommnded) Ruby, or were they just sweeping former stuff under the carpet to keep the sample code terse? Similarily, I was puzzled that it seems to be possible to again extend base classes like Array without being required to subclass and override, instead doing something like class Array def my_super_sort # implementation end end Is this really all that easy? As for style, shouldn't Ruby class definitions just as one class-end block go into a single file instead of these break ups? named as the class -- Posted via http://www.ruby-forum.com/.