From: "Barnett, Aaron" Date: 2001-09-06T04:57:08+09:00 Subject: [ruby-talk:20941] RE: calling original method in overrided method ? i think it'd go something like: Class String alias :to_i_orig :to_i def to_i fail "#{self} is not a valid integer" unless self =~ /^\d*$/ to_i_orig end end -----Original Message----- From: Henry House [mailto:hajhouse@houseag.com] Sent: Wednesday, September 05, 2001 3:46 PM To: ruby-talk@ruby-lang.org Subject: [ruby-talk:20940] calling original method in overrided method? I don't like the default behavior of String#to_i and String#to_f to return zero for any string that contains no recognizable numbers. I had thought to write overriding methods like so: Class String def to_i fail "#{self} is not a valid integer" unless self =~ /^\d*$/ # call original to_i end end ...but I don't how (if it is possible?) to call the original to_i. Am I stuck with using a new method name or a custom string class? -- Henry House OpenPGP key available from http://romana.hajhouse.org/hajhouse.asc