Override def method in CGI class, without altering the class!?

hello all,

I am a newbie to ruby.

how do I override a method from a particular class (in std class lib), just for one program, without modifying the class.

Thanks in advance for all your help.

-Jer A.

···

_________________________________________________________________
Fight Allergies With Live Search http://search.live.com/results.aspx?q=Remedies+For+Spring+Allergies&mkt=en-ca&FORM=SERNEP

Just re-write it in your program where it's needed.

class Foo
   def bar
     //method to override
   end
end

Very simple.

- Jer H.

···

On May 23, 2007, at 8:25 PM, Jer A wrote:

hello all,

I am a newbie to ruby.

how do I override a method from a particular class (in std class lib), just for one program, without modifying the class.

Thanks in advance for all your help.

-Jer A.

_________________________________________________________________
Fight Allergies With Live Search Remedies For Spring Allergies - Search

highlyjhi wrote:

Just re-write it in your program where it's needed.

class Foo
  def bar
    //method to override
  end
end

Very simple.

- Jer H.

hello all,

I am a newbie to ruby.

how do I override a method from a particular class (in std class lib), just for one program, without modifying the class.

Thanks in advance for all your help.

-Jer A.

_________________________________________________________________
Fight Allergies With Live Search http://search.live.com/results.aspx?q=Remedies+For+Spring+Allergies&mkt=en-ca&FORM=SERNEP

Just to clarify, you can define or redefine methods of core classes:

Class String
   def inspect
     "This string's value is \"#{self}\""
   end
end

···

On May 23, 2007, at 8:25 PM, Jer A wrote: