aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel
diff options
context:
space:
mode:
authorVasiliy Ermolovich <younash@gmail.com>2011-12-24 19:33:45 +0300
committerVasiliy Ermolovich <younash@gmail.com>2011-12-24 19:33:45 +0300
commitee2095e10702c9415a842866f98e45875c39a1c2 (patch)
treeb5c7127b76e99c992ee1738dec3037d7378e9bde /activemodel
parent7a2a661b834ec744d3bfb166f1afd546312b739e (diff)
downloadrails-ee2095e10702c9415a842866f98e45875c39a1c2.tar.gz
rails-ee2095e10702c9415a842866f98e45875c39a1c2.tar.bz2
rails-ee2095e10702c9415a842866f98e45875c39a1c2.zip
use Range#min and Range#max to reduce extra statement
Diffstat (limited to 'activemodel')
-rw-r--r--activemodel/lib/active_model/validations/length.rb3
1 files changed, 1 insertions, 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