The comment said that you can optionally pass multiple arguments. The code
doesn't allow this, so I fixed the comment.
To be clear, in case there is pushback: the code was correct and the
comment was wrong. Object#in? should definitely not allow multiple
arguments, because that would make its contract ambiguous. And an
ambiguous contract is worse than useless. People who call it will get
unpredictable behavior.
See related discussions in ActiveSupport, going back to when I first
added Object#in? to Rails:
The comment said that you can optionally pass multiple arguments. The code doesn't allow this, so I fixed the comment.
To be clear, in case there is pushback: the code was correct and the comment was wrong.
Object#in?
should definitely not allow multiple arguments, because that would make its contract ambiguous. And an ambiguous contract is worse than useless. People who call it will get unpredictable behavior.See related discussions in ActiveSupport, going back to when I first added
Object#in?
to Rails: