Class TZInfo::TZDataParser
In: lib/tzinfo/tzdataparser.rb
Parent: Object

Parses tzdata from elsie.nci.nih.gov/pub/ and transforms it into a set of Ruby modules that can be used through Timezone and Country.

Normally, this class wouldn‘t be used. It is only run to update the timezone data and index modules.

Methods

Constants

MIN_YEAR = 1800   Minimum year that will be considered.
MAX_YEAR = 2050   Maximum year that will be considered.

Attributes

exclude_zones  [RW]  Zones to exclude from generation when not using only_zones (set to an array containing zone identifiers).
generate_countries  [RW]  Whether to generate country definitions (set to false to stop countries being generated).
generate_zones  [RW]  Whether to generate zone definitions (set to false to stop zones being generated).
only_zones  [RW]  Limit the set of zones to generate (set to an array containing zone identifiers).

Public Class methods

Initializes a new TZDataParser. input_dir must contain the extracted tzdata tarball. output_dir is the location to output the modules (in definitions and indexes directories).

Parses a month specified in the tz data and converts it to a number between 1 and 12 representing January to December.

Parses an offset string [-]h:m:s (minutes and seconds are optional). Returns the offset in seconds.

Encloses the string in single quotes and escapes any single quotes in the content.

Public Instance methods

Reads the tzdata source and generates the classes. Takes a long time to run. Currently outputs debugging information to standard out.

[Validate]