hellobase-tz 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 0b3f30e49ea12641cb1fec84590eead9f777e77753b71345e31450e7f0841fc6
4
+ data.tar.gz: ac7dae436125005afa207ecafb573c715a3a4ce360d0d7824cdc0e5f9b6813ae
5
+ SHA512:
6
+ metadata.gz: e1c8f963010a46db76d1e5491ea0a69a3972aed13967d24fb85d95aa72404b64f0dc0c9489ae66639d5e221271951675bc6b516cf53abcb02834798465d2f9b3
7
+ data.tar.gz: 83cfc8b80b2e34ea21d36a6ae8747843502824ff2d193527a687e0acce38d8d4522dc67c97ac9e5c8e6e38d49edf39df6ed200fa6703c95c8c651d0232d314b4
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2020 AENEA LLC
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,5 @@
1
+ module Hellobase
2
+ module TimeZones
3
+ VERSION = '0.1.0'
4
+ end
5
+ end
@@ -0,0 +1,23 @@
1
+ require 'tzinfo'
2
+
3
+ module Hellobase
4
+ module TimeZones
5
+ class << self
6
+ def domestic_select_values(country_code)
7
+ TZInfo::Country.get(country_code).zone_info.map {|z| [z.description || z.timezone.friendly_identifier(true), z.identifier] }
8
+ end
9
+
10
+ def foreign_select_values(country_code)
11
+ TZInfo::Country.all.reject {|c| c.code == country_code }.map(&:zone_info).flatten.uniq.map {|z| [z.description || z.timezone.friendly_identifier(false), z.identifier] }
12
+ end
13
+
14
+ def all_select_values(country_code)
15
+ domestic_select_values(country_code) + [['UTC', 'UTC']] + foreign_select_values(country_code)
16
+ end
17
+
18
+ def display_name_for(tz_name)
19
+ (@display_names ||= all_select_values('US').to_h.invert)[tz_name]
20
+ end
21
+ end
22
+ end
23
+ end
data/lib/hellobase.rb ADDED
@@ -0,0 +1,4 @@
1
+ require 'hellobase/time_zones'
2
+
3
+ module Hellobase
4
+ end
metadata ADDED
@@ -0,0 +1,75 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hellobase-tz
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Anthony Wang
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-12-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: tzinfo
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: minitest
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '5.14'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '5.14'
41
+ description:
42
+ email:
43
+ - awang@kodia.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - MIT-LICENSE
49
+ - lib/hellobase.rb
50
+ - lib/hellobase/time_zones.rb
51
+ - lib/hellobase/time_zones/version.rb
52
+ homepage: https://kodia.com
53
+ licenses:
54
+ - MIT
55
+ metadata: {}
56
+ post_install_message:
57
+ rdoc_options: []
58
+ require_paths:
59
+ - lib
60
+ required_ruby_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ required_rubygems_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ requirements: []
71
+ rubygems_version: 3.0.3.1
72
+ signing_key:
73
+ specification_version: 4
74
+ summary: Time zone helpers
75
+ test_files: []