From fdbd6779fe1a9d54c55b401f4b2a92b5e5ef1e8f Mon Sep 17 00:00:00 2001
From: Vasiliy Ermolovich <younash@gmail.com>
Date: Sat, 24 Dec 2011 23:40:09 +0300
Subject: don't call an extra method if options[:tokenizer] is not present

---
 activemodel/lib/active_model/validations/length.rb | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/activemodel/lib/active_model/validations/length.rb b/activemodel/lib/active_model/validations/length.rb
index f91fc3a750..0eba241333 100644
--- a/activemodel/lib/active_model/validations/length.rb
+++ b/activemodel/lib/active_model/validations/length.rb
@@ -56,10 +56,8 @@ module ActiveModel
       private
 
       def tokenize(value)
-        if value.kind_of?(String)
-          if options[:tokenizer]
-            options[:tokenizer].call(value)
-          end
+        if options[:tokenizer] && value.kind_of?(String)
+          options[:tokenizer].call(value)
         end || value
       end
     end
-- 
cgit v1.2.3