method
get_zone
rails latest stable - Class:
ActiveSupport::CoreExtensions::Time::Zones::ClassMethods
get_zone(time_zone)private
No documentation available.
# File activesupport/lib/active_support/core_ext/time/zones.rb, line 55
def get_zone(time_zone)
return time_zone if time_zone.nil? || time_zone.is_a?(TimeZone)
# lookup timezone based on identifier (unless we've been passed a TZInfo::Timezone)
unless time_zone.respond_to?(:period_for_local)
time_zone = 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?(TimeZone) ? time_zone : TimeZone.create(time_zone.name, nil, time_zone)
end
end