ALL
Use downcase! with caution in Ruby
Ruby provides ! to change state of some object in place. Hence if you see some functions have ! appended, it means the state of the caller of the function is expected to be changed. This is a very interesting Ruby feature. But sometimes one should be cautious when using this kind of functions because you would get unexpected behavior if using improperly.Let's take an example of String#downcase!. According to the documentation.Downcases the contents of str, returning nil if no changes were made. Note: case replacement is effective only in ASCII region.If there is a String pl...
4,151 0 RUBY EXCLAMATION MARK DOWNCASE