Merge pull request #4172 from nashby/refactor-tokenizer

don't call an extra method if options[:tokenizer] is not present
This commit is contained in:
José Valim 2011-12-24 12:48:45 -08:00
commit b28ed2bd4f
1 changed files with 2 additions and 4 deletions

View File

@ -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