From: Kurt Euler Date: 2003-09-04T15:01:21+09:00 Subject: Re: Multiple gsub statements in one line possible? Hal- Right, I got a nil error. Ah well. Thanks! -k Date: Thu, 4 Sep 2003 14:45:08 +0900 References: * In-reply-to: * Kurt Euler wrote: > All- > > For the string called pkg_bug_base, I'm currently using the following code to make some substitutions: > > pkg_bug_base.gsub!(//, sp_num_string) > pkg_bug_base.gsub!(//, rel_num) > > Question: Is there a way to put this all on one line? I tried this, but the code crashed here: > > pkg_bug_base.gsub!(//, sp_num_string).gsub!(//, rel_num) What probably happened s that the first gsub! didn't actually change anything. In that case, it returns nil. This is a feature that allows you to test whether anything was changed. Unfortunately, it also prevents safe chaining. I'll bet your error was that nil doesn't have a gsub! method or something like that. If so, this is what happened. Hal