Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
override def method in CGI class, without altering the class!??????
Jer A
5/24/2007 12:25:00 AM
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&F...
2 Answers
highlyjhi
5/24/2007 2:25:00 AM
0
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
http://search...
> results.aspx?q=Remedies+For+Spring+Allergies&mkt=en-ca&FORM=SERNEP
>
>
Dan Zwell
5/24/2007 6:06:00 AM
0
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.
>
>
> 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
>>
http://search.live.com/results.aspx?q=Remedies+For+Spring+Allergies&mkt=en-ca&F...
>>
>>
>>
>
>
>
Just to clarify, you can define or redefine methods of core classes:
Class String
def inspect
"This string's value is \"#{self}\""
end
end
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
override def method in CGI class, without altering the class!??????
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password