Packages
tzdata
0.1.201605
1.1.4
1.1.3
1.1.2
1.1.1
1.1.0
1.0.5
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
1.0.0-rc.1
1.0.0-rc.0
0.5.22
0.5.21
0.5.20
0.5.19
0.5.18
0.5.17
0.5.16
0.5.15
0.5.14
0.5.13
0.5.12
0.5.11
0.5.10
0.5.9
0.5.8
0.5.7
0.5.6
0.5.5
0.5.4
0.5.3
0.5.2
0.5.1
0.5.0
0.1.201805
0.1.201605
0.1.201603
0.1.201601
0.1.8
0.1.7
0.1.6
0.1.5
0.1.4
0.1.3
0.1.2
0.1.1
0.1.0
0.0.2
0.0.1
Tzdata is a parser and library for the tz database.
Current section
Files
Jump to
Current section
Files
lib/tzdata/basic_data.ex
defmodule Tzdata.BasicData do
@moduledoc false
# this module formerly known as TzData
alias Tzdata.Parser
alias Tzdata.ParserOrganizer, as: Organizer
file_names = ~w(africa antarctica asia australasia backward etcetera europe northamerica pacificnew southamerica)s
all_files_read = Enum.map(file_names, fn file_name -> {String.to_atom(file_name), Parser.read_file(file_name)} end)
all_files_flattened = all_files_read |> Enum.map(fn {_name, read_file} -> read_file end) |> List.flatten
rules = Organizer.rules(all_files_flattened)
zones = Organizer.zones(all_files_flattened)
links = Organizer.links(all_files_flattened)
Enum.each(zones, fn {k, v} -> def zone(unquote(k)), do: {:ok, unquote(Macro.escape(v))} end)
Enum.each(rules, fn {k, v} -> def rules(unquote(k)), do: {:ok, unquote(Macro.escape(v))} end)
Enum.each(links, fn {k, v} -> def zone(unquote(k)), do: {:ok, unquote(Macro.escape(zones[v]))} end)
# if a function for a specific zone or rule has not been defined, these not-found-functions will be called
def zone(_), do: {:error, :not_found}
def rules(_), do: {:error, :not_found}
# Provide lists of zone- and link-names
def zone_list, do: unquote(Macro.escape(Organizer.zone_list(all_files_flattened)))
def link_list, do: unquote(Macro.escape(Organizer.link_list(all_files_flattened)))
def zone_and_link_list, do: unquote(Macro.escape(Organizer.zone_and_link_list(all_files_flattened)))
# Provide map of links
def links, do: unquote(Macro.escape(links))
# Group by filename
by_group = all_files_read
|> Enum.map(fn {name, file_read} -> {name, Organizer.zone_and_link_list(file_read)} end)
|> Enum.into(Map.new)
def zones_and_links_by_groups, do: unquote(Macro.escape(by_group))
end