class TZInfo::DataSources::ZoneinfoDataSource
def enum_timezones(dir, exclude = [], &block)
- Yieldparam: path - the path of a time zone file as an
Other tags:
- Yield: - the path of each time zone file found is passed to
Parameters:
-
exclude
(Array
) -- file names to exclude when scanning -
dir
(Array
) -- the directory to enumerate as an `Array` of
def enum_timezones(dir, exclude = [], &block) Dir.foreach(File.join(@zoneinfo_dir, *dir)) do |entry| begin entry.encode!(Encoding::UTF_8) rescue EncodingError next end unless entry =~ /\./ || exclude.include?(entry) RubyCoreSupport.untaint(entry) path = dir + [entry] full_path = File.join(@zoneinfo_dir, *path) if File.directory?(full_path) enum_timezones(path, [], &block) elsif File.file?(full_path) yield path end end end end