1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

use empty? on the hash to avoid another method call

This commit is contained in:
Aaron Patterson 2012-03-16 12:15:31 -07:00
parent 4c8a5a0087
commit 090156adeb

View file

@ -266,7 +266,7 @@ module ActiveSupport
# Time.zone.parse('22:30:00') # => Fri, 31 Dec 1999 22:30:00 HST -10:00 # Time.zone.parse('22:30:00') # => Fri, 31 Dec 1999 22:30:00 HST -10:00
def parse(str, now=now) def parse(str, now=now)
date_parts = Date._parse(str) date_parts = Date._parse(str)
return if date_parts.blank? return if date_parts.empty?
time = Time.parse(str, now) rescue DateTime.parse(str) time = Time.parse(str, now) rescue DateTime.parse(str)
if date_parts[:offset].nil? if date_parts[:offset].nil?
ActiveSupport::TimeWithZone.new(nil, self, time) ActiveSupport::TimeWithZone.new(nil, self, time)