Ruby has a quasi-convention of taking a method, slightly modifying its behavior, and denoting it with a trailing exclaimation mark, e.g.
#select!. Sometimes these methods raise an error, modify the receiver in place, or return
nil on no-op, or do some combination of these, or something else entirely. Such methods are collectively referred to as “bang” methods, and there’s no hard-and-fast rule for what makes them special—just that they are “more dangerous” than their non-bang counterparts.
Today I’d like to write about bang methods that modify their receivers in place and return
nil on no-op, and how you can improve performance in Ruby applications by (ab)using them to reduce object churn in hot paths.