http://dablog.rubypal.com/2007/8/15/bang-methods-or-danger-will-rubyist
What ! does (and does not) mean
The ! in method names that end with ! means, “This method is dangerous”—or, more precisely, this method is the “dangerous” version of an otherwise equivalent method, with the same name minus the !. “Danger” is relative; the ! doesn’t mean anything at all unless the method name it’s in corresponds to a similar but bang-less method name.So, for example,gsub!is the dangerous version ofgsub.exit!is the dangerous version ofexit.flatten!is the dangerous version offlatten. And so forth.The ! does not mean “This method changes its receiver.” A lot of “dangerous” methods do change their receivers. But some don’t. I repeat: ! does not mean that the method changes its receiver.
you can read the rest in the article
0 comments:
Post a Comment