class method
self.get_zone
Ruby on Rails 3.0.20
Since v3.0.20 Last seen in v3.0.20 PrivateSignature
self.get_zone(time_zone)
No documentation comment.
Parameters
-
time_zonereq
Source
# File activesupport/lib/active_support/core_ext/time/zones.rb, line 45
def get_zone(time_zone)
return time_zone if time_zone.nil? || time_zone.is_a?(ActiveSupport::TimeZone)
# lookup timezone based on identifier (unless we've been passed a TZInfo::Timezone)
unless time_zone.respond_to?(:period_for_local)
time_zone = ActiveSupport::TimeZone[time_zone] || TZInfo::Timezone.get(time_zone) rescue nil
end
# Return if a TimeZone instance, or wrap in a TimeZone instance if a TZInfo::Timezone
if time_zone
time_zone.is_a?(ActiveSupport::TimeZone) ? time_zone : ActiveSupport::TimeZone.create(time_zone.name, nil, time_zone)
end
end
Defined in activesupport/lib/active_support/core_ext/time/zones.rb line 45
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Time