@@ -87,6 +87,30 @@ class ZoneinfoDataSource < DataSource
8787# The default value of ZoneinfoDataSource.alternate_iso3166_tab_search_path.
8888DEFAULT_ALTERNATE_ISO3166_TAB_SEARCH_PATH = [ '/usr/share/misc/iso3166.tab' , '/usr/share/misc/iso3166' ] . freeze
8989
90+ # File and directories in the top level zoneinfo directory that will be
91+ # excluded from the list of available time zones:
92+ #
93+ # - +VERSION is included on Mac OS X.
94+ # - leapseconds is a list of leap seconds.
95+ # - localtime is the current local timezone (may be a link).
96+ # - posix, posixrules and right are directories containing other versions
97+ # of the zoneinfo files.
98+ # - SECURITY is included in the Arch Linux tzdata package.
99+ # - src is a directory containing the tzdata source included on Solaris.
100+ # - timeconfig is a symlink included on Slackware.
101+ EXCLUDED_FILENAMES = [
102+ '+VERSION' ,
103+ 'leapseconds' ,
104+ 'localtime' ,
105+ 'posix' ,
106+ 'posixrules' ,
107+ 'right' ,
108+ 'SECURITY' ,
109+ 'src' ,
110+ 'timeconfig'
111+ ] . freeze
112+ private_constant :EXCLUDED_FILENAMES
113+
90114# Paths to be checked to find the system zoneinfo directory.
91115@@search_path = DEFAULT_SEARCH_PATH . dup
92116
@@ -352,16 +376,8 @@ def find_zoneinfo_dir
352376# identifiers.
353377def load_timezone_index
354378index = [ ]
355-
356- # Ignoring particular files:
357- # +VERSION is included on Mac OS X.
358- # leapseconds is a list of leap seconds.
359- # localtime is the current local timezone (may be a link).
360- # posix, posixrules and right are directories containing other versions of the zoneinfo files.
361- # src is a directory containing the tzdata source included on Solaris.
362- # timeconfig is a symlink included on Slackware.
363-
364- enum_timezones ( nil , [ '+VERSION' , 'leapseconds' , 'localtime' , 'posix' , 'posixrules' , 'right' , 'src' , 'timeconfig' ] ) do |identifier |
379+
380+ enum_timezones ( nil , EXCLUDED_FILENAMES ) do |identifier |
365381index <<identifier
366382end
367383