On Sep 7, 2004, at 11:20 AM, Dany Cayouette wrote:

> On Wed, 8 Sep 2004 02:24:53 +0900
> Edwin Eyan Moragas <haaktu / gmail.com> wrote:
>
>> On Wed, 8 Sep 2004 01:30:08 +0900, Dany Cayouette
>> <danyc / nortelnetworks.com> wrote:
>>> I am a ruby newbie and am intimitaded by posting to this 
>>> newsgroup... I only made two
>>
>> they're talking about this at the moment. i'll say "don;t be" :-)
>>
>
> I've noticed the discussion which prompted me to write this note.  I 
> was concerned with 'breaking' some rules with my postings.
>
>>> postings related to modules included with base ruby 1.8.0 and 1.8.1  
>>> (net/imap and
>>> net/telnet).  I think I did my homework in researching the behavior 
>>> I observed, but never saw
>>> any replies to my postings.
>>
>> replies may take some time. your posts are not ignored altogether. 
>> just that
>> others might be on to something else at the moment or are not just 
>> using the
>> pertinent module you are using (like me)
>>
>
> Thanks for the reply.  At least I know my postings are going to the 
> outside world.
>
> Maybe you can help me with this question.  For argument sakes, lets 
> say that the problem I have seems to be in method preprocess of module 
> Net::Telnet.  I need to get a solution for my script.  I don't think I 
> want to modify the $PREFIX/lib/ruby/1.8/net/telnet.rb directly.  I 
> would want to 'override' the standard version with mine.
>
> How would I do that?...  would I just add to my script something like
>
> Module Net
>   class Telnet
>    def preprocess (string)
>     copy of the orginal method with my few lines of changes
>    end
>   end
> end

Yep! That would be the accepted way. Although, if you think there's 
*any* possibility that you might want to use the original method (for 
testing or something), you might want to alias it, just so it hangs 
around:

Module Net
   class Telnet
    alias :original_preprocess :preprocess
    def preprocess (string)
     copy of the orginal method with my few lines of changes
    end
   end
end

cheers,
Mark




>
> Thanks,
>
> Dany