diff options
author | Sean Griffin <sean@seantheprogrammer.com> | 2015-09-21 09:24:39 -0600 |
---|---|---|
committer | Sean Griffin <sean@seantheprogrammer.com> | 2015-09-21 10:12:31 -0600 |
commit | 22cc2b86f790b08bf58311bb6eb3bb148cb1dea9 (patch) | |
tree | 0e38c2f374aba0fde84391a286c6b74e130208af /activemodel/lib/active_model | |
parent | e467deb6c66d9b45a0c596706284c140f8e1f1b3 (diff) | |
download | rails-22cc2b86f790b08bf58311bb6eb3bb148cb1dea9.tar.gz rails-22cc2b86f790b08bf58311bb6eb3bb148cb1dea9.tar.bz2 rails-22cc2b86f790b08bf58311bb6eb3bb148cb1dea9.zip |
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.
Diffstat (limited to 'activemodel/lib/active_model')
-rw-r--r-- | activemodel/lib/active_model/type/helpers/time_value.rb | 7 |
1 files changed, 3 insertions, 4 deletions
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. |