aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/time_with_zone.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support/time_with_zone.rb')
-rw-r--r--activesupport/lib/active_support/time_with_zone.rb21
1 files changed, 10 insertions, 11 deletions
diff --git a/activesupport/lib/active_support/time_with_zone.rb b/activesupport/lib/active_support/time_with_zone.rb
index d7c35e1950..9cc82e9187 100644
--- a/activesupport/lib/active_support/time_with_zone.rb
+++ b/activesupport/lib/active_support/time_with_zone.rb
@@ -1,7 +1,7 @@
-require 'active_support/duration'
-require 'active_support/values/time_zone'
-require 'active_support/core_ext/object/acts_like'
-require 'active_support/core_ext/date_and_time/compatibility'
+require "active_support/duration"
+require "active_support/values/time_zone"
+require "active_support/core_ext/object/acts_like"
+require "active_support/core_ext/date_and_time/compatibility"
module ActiveSupport
# A Time-like class that can represent a time in any time zone. Necessary
@@ -36,14 +36,13 @@ module ActiveSupport
# t.is_a?(Time) # => true
# t.is_a?(ActiveSupport::TimeWithZone) # => true
class TimeWithZone
-
# Report class name as 'Time' to thwart type checking.
def self.name
- 'Time'
+ "Time"
end
PRECISIONS = Hash.new { |h, n| h[n] = "%FT%T.%#{n}N".freeze }
- PRECISIONS[0] = '%FT%T'.freeze
+ PRECISIONS[0] = "%FT%T".freeze
include Comparable, DateAndTime::Compatibility
attr_reader :time_zone
@@ -171,12 +170,12 @@ module ActiveSupport
end
def init_with(coder) #:nodoc:
- initialize(coder['utc'], coder['zone'], coder['time'])
+ initialize(coder["utc"], coder["zone"], coder["time"])
end
def encode_with(coder) #:nodoc:
- coder.tag = '!ruby/object:ActiveSupport::TimeWithZone'
- coder.map = { 'utc' => utc, 'zone' => time_zone, 'time' => time }
+ coder.tag = "!ruby/object:ActiveSupport::TimeWithZone"
+ coder.map = { "utc" => utc, "zone" => time_zone, "time" => time }
end
# Returns a string of the object's date and time in the format used by
@@ -459,7 +458,7 @@ module ActiveSupport
def method_missing(sym, *args, &block)
wrap_with_time_zone time.__send__(sym, *args, &block)
rescue NoMethodError => e
- raise e, e.message.sub(time.inspect, self.inspect), e.backtrace
+ raise e, e.message.sub(time.inspect, inspect), e.backtrace
end
private