From 22cc2b86f790b08bf58311bb6eb3bb148cb1dea9 Mon Sep 17 00:00:00 2001 From: Sean Griffin Date: Mon, 21 Sep 2015 09:24:39 -0600 Subject: Various stylistic nitpicks We do not need to require each file from AM individually, the type module does that for us. Even if the classes are extremely small right now, I'd rather keep any custom classes needed by AR in their own files, as they can easily have more complex changes in the future. --- activemodel/lib/active_model/type/helpers/time_value.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'activemodel/lib') diff --git a/activemodel/lib/active_model/type/helpers/time_value.rb b/activemodel/lib/active_model/type/helpers/time_value.rb index 5a899d43ec..c55bb1e136 100644 --- a/activemodel/lib/active_model/type/helpers/time_value.rb +++ b/activemodel/lib/active_model/type/helpers/time_value.rb @@ -19,11 +19,11 @@ module ActiveModel value end - + def is_utc? ::Time.zone_default =~ 'UTC' end - + def default_timezone ::Time.zone_default end @@ -41,7 +41,6 @@ module ActiveModel def new_time(year, mon, mday, hour, min, sec, microsec, offset = nil) # Treat 0000-00-00 00:00:00 as nil. return if year.nil? || (year == 0 && mon == 0 && mday == 0) - if offset time = ::Time.utc(year, mon, mday, hour, min, sec, microsec) rescue nil @@ -53,7 +52,7 @@ module ActiveModel ::Time.public_send(default_timezone, year, mon, mday, hour, min, sec, microsec) rescue nil end end - + ISO_DATETIME = /\A(\d{4})-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)(\.\d+)?\z/ # Doesn't handle time zones. -- cgit v1.2.3