From: Angus Hammond Date: 2010-07-13T01:53:30+09:00 Subject: Re: Substitution What that says is use the gsub! method on the object pointed to by idea (which is a string). Then in order to tell gsub! how to work we pass it some parameters which are real (the thing to look for) and code (the thing to replace it with). The part you seem to be having trouble with is the "dot syntax". The dot says run the method after the dot on the object returned by the thing before the dot. On 12/07/10 17:35, Abder-rahman Ali wrote: > I have this part of code from "Why's poignant guide to Ruby" that is > intended to make substitution: > > Note: code_words here is a hash > > ... > idea = gets > code_words.each do |real, code| > idea.gsub!(real, code) > end > ... > > I know that "real" is what to find, and "code" is what to put in place. > But, what I'm not getting here is why is this written: > > idea.gsub!(.... > > I don't mean the gsub! method, but, why "idea"? What does it here? How > can we read that line of script? > > Thanks. >