holidays_br 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.
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HolidaysBr
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "holidays_br/version"
4
+ require 'json'
5
+
6
+ module HolidaysBr
7
+ extend self
8
+
9
+ def is_holiday(state, city, date)
10
+ load_holidays(state)
11
+
12
+ return false unless @holidays.key?(city) && @holidays[city].key?(date)
13
+
14
+ holiday_info = @holidays[city][date]
15
+ {
16
+ name: holiday_info['name'],
17
+ type: holiday_info['type']
18
+ }
19
+ end
20
+
21
+ private
22
+
23
+ def load_holidays(state)
24
+ file_path = File.join(File.dirname(__FILE__), '..', 'holidays', "#{state}.json")
25
+ @holidays = JSON.parse(File.read(file_path))
26
+ end
27
+ end
metadata ADDED
@@ -0,0 +1,72 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: holidays_br
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - IgorFZ
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2023-10-04 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Write a longer description or delete this line.
14
+ email:
15
+ - igorf.zamp@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - holidays/AC.json
21
+ - holidays/AL.json
22
+ - holidays/AM.json
23
+ - holidays/AP.json
24
+ - holidays/BA.json
25
+ - holidays/CE.json
26
+ - holidays/DF.json
27
+ - holidays/ES.json
28
+ - holidays/GO.json
29
+ - holidays/MA.json
30
+ - holidays/MG.json
31
+ - holidays/MS.json
32
+ - holidays/MT.json
33
+ - holidays/PA.json
34
+ - holidays/PB.json
35
+ - holidays/PE.json
36
+ - holidays/PI.json
37
+ - holidays/PR.json
38
+ - holidays/RJ.json
39
+ - holidays/RN.json
40
+ - holidays/RO.json
41
+ - holidays/RR.json
42
+ - holidays/RS.json
43
+ - holidays/SC.json
44
+ - holidays/SE.json
45
+ - holidays/SP.json
46
+ - holidays/TO.json
47
+ - lib/holidays_br.rb
48
+ - lib/holidays_br/version.rb
49
+ homepage:
50
+ licenses:
51
+ - MIT
52
+ metadata: {}
53
+ post_install_message:
54
+ rdoc_options: []
55
+ require_paths:
56
+ - lib
57
+ required_ruby_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 2.6.0
62
+ required_rubygems_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ requirements: []
68
+ rubygems_version: 3.1.6
69
+ signing_key:
70
+ specification_version: 4
71
+ summary: Write a short summary, because RubyGems requires one.
72
+ test_files: []