From ee2095e10702c9415a842866f98e45875c39a1c2 Mon Sep 17 00:00:00 2001 From: Vasiliy Ermolovich Date: Sat, 24 Dec 2011 19:33:45 +0300 Subject: use Range#min and Range#max to reduce extra statement --- activemodel/lib/active_model/validations/length.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/activemodel/lib/active_model/validations/length.rb b/activemodel/lib/active_model/validations/length.rb index 760b5271bf..f91fc3a750 100644 --- a/activemodel/lib/active_model/validations/length.rb +++ b/activemodel/lib/active_model/validations/length.rb @@ -13,8 +13,7 @@ module ActiveModel 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 -- cgit v1.2.3