A
Abder-rahman Ali
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.
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.