提交 cf0fd053 编写于 作者: J Jeremy Kemper

Merge pull request #4166 from nashby/range-min-max

use Range#min and Range#max to reduce extra statement
......@@ -13,8 +13,7 @@ class LengthValidator < EachValidator
def initialize(options)
if range = (options.delete(:in) || options.delete(:within))
raise ArgumentError, ":in and :within must be a Range" unless range.is_a?(Range)
options[:minimum], options[:maximum] = range.begin, range.end
options[:maximum] -= 1 if range.exclude_end?
options[:minimum], options[:maximum] = range.min, range.max
end
super
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册