From: Gregory Brown Date: 2009-03-02T11:01:02+09:00 Subject: Re: Rub 1.9: "inline rescue" doesn't work? On Sun, Mar 1, 2009 at 6:58 PM, Iņaki Baz Castillo wrote: > Hi, is there any explanation for the folowing big difference between the same > code in 1.8 and 1.9?: > > > 1.8) > > aaa = 123.capitalize rescue 444 > => 444 > > > 1.9) > > aaa = 123.capitalize rescue 444 > NoMethodError: undefined method `capitalize' for 123:Fixnum >> RUBY_VERSION => "1.9.1" >> 123.captialize rescue 444 => 444 But please, don't use this technique. It creates huge debugging nightmares. Instead, just do: aaa = obj.respond_to?(:capitalize) ? obj.capitalize : 444