提交 9fa59ca2 编写于 作者: X Xavier Noria

adds a comments that clarifies why Range#include? chooses the comparison operator

上级 edfe7d80
......@@ -9,6 +9,7 @@ class Range
# (5..9).include?(11) # => false
def include_with_range?(value)
if value.is_a?(::Range)
# 1...10 includes 1..9 but it does not include 1..10.
operator = exclude_end? && !value.exclude_end? ? :< : :<=
include_without_range?(value.first) && value.last.send(operator, last)
else
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册