Module: RequestInfo::Detectors::TimezoneDetector

Defined in:
lib/request_info/detectors/timezone_detector.rb

Overview

Detects Timezone related information

Instance Method Summary collapse

Instance Method Details

#analyze(_env) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/request_info/detectors/timezone_detector.rb', line 10

def analyze(_env)
  super

  results = RequestInfo.results
  tzinfo_id, tzinfo = get_tzinfo_from_ipinfo(results.ipinfo)
  return unless tzinfo_id && tzinfo

  results.timezone = tzinfo
  results.timezone_id = tzinfo_id
  results.timezone_offset = calculate_utc_offset(tzinfo)
  results.timezone_desc = tz_description(tzinfo)
end