matey 0.1.4 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 12a21ea4053dc459c4b23e8e3d2aba0f1214929392c281d40d7055e5a4de26e0
4
- data.tar.gz: c2784dda2825209d14dfe8ee9bac7963236caf786a440d980ca1c40d66fcd3e2
3
+ metadata.gz: 6ec5f596ad8c385f4f9bc2e0ff84139330e05967c3a4332818274d80084cd9f1
4
+ data.tar.gz: 25b4c587c7678af5d65e7e5e54d7c0b6f0711d7a8aba8ee30ac90775a6a08cf5
5
5
  SHA512:
6
- metadata.gz: 02a283bbedef06f95cdbdfe30b00c803b35bd0e94f163921166eb82ab3cd53273fe3ac91776c0596d06c83f7c70a19687cd8611e183bb601bbb23811bdb60e57
7
- data.tar.gz: b4488783a6edbf40c39b1eea8e181a7bad5788eb7246586f44a81a4f4dbdd88e3b9988be3de78b2b37806981422eff0e3a45510a7b2f8835fcf2b8639ac6e161
6
+ metadata.gz: 27389878158cf281c15d994ef85ed961f8a3bfaa5e26baf2ece294596f68029df12ea46d5e95974bcd1a04fc99de9f70d4437c1284d7cc7caddaa4e2f7fb40a1
7
+ data.tar.gz: 60cf067eee9938b81e44bba79ee4c93dd22e148a4cfe23e1725428340805f4f92e04f5bbf96959a0e3fd7338b85ad1ddc84fe828a7712a1ec1e0bf7d12bb8d5a
data/Gemfile.lock CHANGED
@@ -1,74 +1,75 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- matey (0.1.4)
5
- ahoy_matey (~> 4.0)
4
+ matey (0.1.6)
5
+ ahoy_matey (>= 4.0)
6
+ groupdate (~> 6.4.0)
6
7
  view_component (~> 2.74)
7
8
 
8
9
  GEM
9
10
  remote: https://rubygems.org/
10
11
  specs:
11
- actioncable (7.0.5)
12
- actionpack (= 7.0.5)
13
- activesupport (= 7.0.5)
12
+ actioncable (7.0.8)
13
+ actionpack (= 7.0.8)
14
+ activesupport (= 7.0.8)
14
15
  nio4r (~> 2.0)
15
16
  websocket-driver (>= 0.6.1)
16
- actionmailbox (7.0.5)
17
- actionpack (= 7.0.5)
18
- activejob (= 7.0.5)
19
- activerecord (= 7.0.5)
20
- activestorage (= 7.0.5)
21
- activesupport (= 7.0.5)
17
+ actionmailbox (7.0.8)
18
+ actionpack (= 7.0.8)
19
+ activejob (= 7.0.8)
20
+ activerecord (= 7.0.8)
21
+ activestorage (= 7.0.8)
22
+ activesupport (= 7.0.8)
22
23
  mail (>= 2.7.1)
23
24
  net-imap
24
25
  net-pop
25
26
  net-smtp
26
- actionmailer (7.0.5)
27
- actionpack (= 7.0.5)
28
- actionview (= 7.0.5)
29
- activejob (= 7.0.5)
30
- activesupport (= 7.0.5)
27
+ actionmailer (7.0.8)
28
+ actionpack (= 7.0.8)
29
+ actionview (= 7.0.8)
30
+ activejob (= 7.0.8)
31
+ activesupport (= 7.0.8)
31
32
  mail (~> 2.5, >= 2.5.4)
32
33
  net-imap
33
34
  net-pop
34
35
  net-smtp
35
36
  rails-dom-testing (~> 2.0)
36
- actionpack (7.0.5)
37
- actionview (= 7.0.5)
38
- activesupport (= 7.0.5)
37
+ actionpack (7.0.8)
38
+ actionview (= 7.0.8)
39
+ activesupport (= 7.0.8)
39
40
  rack (~> 2.0, >= 2.2.4)
40
41
  rack-test (>= 0.6.3)
41
42
  rails-dom-testing (~> 2.0)
42
43
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
43
- actiontext (7.0.5)
44
- actionpack (= 7.0.5)
45
- activerecord (= 7.0.5)
46
- activestorage (= 7.0.5)
47
- activesupport (= 7.0.5)
44
+ actiontext (7.0.8)
45
+ actionpack (= 7.0.8)
46
+ activerecord (= 7.0.8)
47
+ activestorage (= 7.0.8)
48
+ activesupport (= 7.0.8)
48
49
  globalid (>= 0.6.0)
49
50
  nokogiri (>= 1.8.5)
50
- actionview (7.0.5)
51
- activesupport (= 7.0.5)
51
+ actionview (7.0.8)
52
+ activesupport (= 7.0.8)
52
53
  builder (~> 3.1)
53
54
  erubi (~> 1.4)
54
55
  rails-dom-testing (~> 2.0)
55
56
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
56
- activejob (7.0.5)
57
- activesupport (= 7.0.5)
57
+ activejob (7.0.8)
58
+ activesupport (= 7.0.8)
58
59
  globalid (>= 0.3.6)
59
- activemodel (7.0.5)
60
- activesupport (= 7.0.5)
61
- activerecord (7.0.5)
62
- activemodel (= 7.0.5)
63
- activesupport (= 7.0.5)
64
- activestorage (7.0.5)
65
- actionpack (= 7.0.5)
66
- activejob (= 7.0.5)
67
- activerecord (= 7.0.5)
68
- activesupport (= 7.0.5)
60
+ activemodel (7.0.8)
61
+ activesupport (= 7.0.8)
62
+ activerecord (7.0.8)
63
+ activemodel (= 7.0.8)
64
+ activesupport (= 7.0.8)
65
+ activestorage (7.0.8)
66
+ actionpack (= 7.0.8)
67
+ activejob (= 7.0.8)
68
+ activerecord (= 7.0.8)
69
+ activesupport (= 7.0.8)
69
70
  marcel (~> 1.0)
70
71
  mini_mime (>= 1.1.0)
71
- activesupport (7.0.5)
72
+ activesupport (7.0.8)
72
73
  concurrent-ruby (~> 1.0, >= 1.0.2)
73
74
  i18n (>= 1.6, < 2)
74
75
  minitest (>= 5.1)
@@ -78,6 +79,7 @@ GEM
78
79
  device_detector
79
80
  safely_block (>= 0.2.1)
80
81
  ast (2.4.2)
82
+ base64 (0.1.1)
81
83
  builder (3.2.4)
82
84
  concurrent-ruby (1.2.2)
83
85
  crass (1.0.6)
@@ -85,7 +87,7 @@ GEM
85
87
  debug (1.8.0)
86
88
  irb (>= 1.5.0)
87
89
  reline (>= 0.3.1)
88
- device_detector (1.1.0)
90
+ device_detector (1.1.1)
89
91
  diff-lcs (1.5.0)
90
92
  erubi (1.12.0)
91
93
  factory_bot (6.2.1)
@@ -93,16 +95,19 @@ GEM
93
95
  factory_bot_rails (6.2.0)
94
96
  factory_bot (~> 6.2.0)
95
97
  railties (>= 5.0.0)
96
- globalid (1.1.0)
97
- activesupport (>= 5.0)
98
+ globalid (1.2.1)
99
+ activesupport (>= 6.1)
100
+ groupdate (6.4.0)
101
+ activesupport (>= 6.1)
98
102
  i18n (1.14.1)
99
103
  concurrent-ruby (~> 1.0)
100
104
  io-console (0.6.0)
101
- irb (1.7.0)
102
- reline (>= 0.3.0)
105
+ irb (1.8.1)
106
+ rdoc
107
+ reline (>= 0.3.8)
103
108
  json (2.6.3)
104
109
  language_server-protocol (3.17.0.3)
105
- lint_roller (1.0.0)
110
+ lint_roller (1.1.0)
106
111
  loofah (2.21.3)
107
112
  crass (~> 1.0.2)
108
113
  nokogiri (>= 1.12.0)
@@ -113,71 +118,76 @@ GEM
113
118
  net-smtp
114
119
  marcel (1.0.2)
115
120
  method_source (1.0.0)
116
- mini_mime (1.1.2)
117
- minitest (5.18.1)
118
- net-imap (0.3.6)
121
+ mini_mime (1.1.5)
122
+ minitest (5.20.0)
123
+ net-imap (0.3.7)
119
124
  date
120
125
  net-protocol
121
126
  net-pop (0.1.2)
122
127
  net-protocol
123
128
  net-protocol (0.2.1)
124
129
  timeout
125
- net-smtp (0.3.3)
130
+ net-smtp (0.4.0)
126
131
  net-protocol
127
132
  nio4r (2.5.9)
128
- nokogiri (1.15.2-aarch64-linux)
133
+ nokogiri (1.15.4-aarch64-linux)
129
134
  racc (~> 1.4)
130
- nokogiri (1.15.2-x86_64-darwin)
135
+ nokogiri (1.15.4-x86_64-darwin)
131
136
  racc (~> 1.4)
132
- nokogiri (1.15.2-x86_64-linux)
137
+ nokogiri (1.15.4-x86_64-linux)
133
138
  racc (~> 1.4)
134
139
  parallel (1.23.0)
135
140
  parser (3.2.2.3)
136
141
  ast (~> 2.4.1)
137
142
  racc
143
+ psych (5.1.0)
144
+ stringio
138
145
  racc (1.7.1)
139
- rack (2.2.7)
146
+ rack (2.2.8)
140
147
  rack-test (2.1.0)
141
148
  rack (>= 1.3)
142
- rails (7.0.5)
143
- actioncable (= 7.0.5)
144
- actionmailbox (= 7.0.5)
145
- actionmailer (= 7.0.5)
146
- actionpack (= 7.0.5)
147
- actiontext (= 7.0.5)
148
- actionview (= 7.0.5)
149
- activejob (= 7.0.5)
150
- activemodel (= 7.0.5)
151
- activerecord (= 7.0.5)
152
- activestorage (= 7.0.5)
153
- activesupport (= 7.0.5)
149
+ rails (7.0.8)
150
+ actioncable (= 7.0.8)
151
+ actionmailbox (= 7.0.8)
152
+ actionmailer (= 7.0.8)
153
+ actionpack (= 7.0.8)
154
+ actiontext (= 7.0.8)
155
+ actionview (= 7.0.8)
156
+ activejob (= 7.0.8)
157
+ activemodel (= 7.0.8)
158
+ activerecord (= 7.0.8)
159
+ activestorage (= 7.0.8)
160
+ activesupport (= 7.0.8)
154
161
  bundler (>= 1.15.0)
155
- railties (= 7.0.5)
156
- rails-dom-testing (2.0.3)
157
- activesupport (>= 4.2.0)
162
+ railties (= 7.0.8)
163
+ rails-dom-testing (2.2.0)
164
+ activesupport (>= 5.0.0)
165
+ minitest
158
166
  nokogiri (>= 1.6)
159
167
  rails-html-sanitizer (1.6.0)
160
168
  loofah (~> 2.21)
161
169
  nokogiri (~> 1.14)
162
- railties (7.0.5)
163
- actionpack (= 7.0.5)
164
- activesupport (= 7.0.5)
170
+ railties (7.0.8)
171
+ actionpack (= 7.0.8)
172
+ activesupport (= 7.0.8)
165
173
  method_source
166
174
  rake (>= 12.2)
167
175
  thor (~> 1.0)
168
176
  zeitwerk (~> 2.5)
169
177
  rainbow (3.1.1)
170
178
  rake (13.0.6)
179
+ rdoc (6.5.0)
180
+ psych (>= 4.0.0)
171
181
  regexp_parser (2.8.1)
172
- reline (0.3.5)
182
+ reline (0.3.8)
173
183
  io-console (~> 0.5)
174
- rexml (3.2.5)
184
+ rexml (3.2.6)
175
185
  rspec-core (3.12.2)
176
186
  rspec-support (~> 3.12.0)
177
187
  rspec-expectations (3.12.3)
178
188
  diff-lcs (>= 1.2.0, < 2.0)
179
189
  rspec-support (~> 3.12.0)
180
- rspec-mocks (3.12.5)
190
+ rspec-mocks (3.12.6)
181
191
  diff-lcs (>= 1.2.0, < 2.0)
182
192
  rspec-support (~> 3.12.0)
183
193
  rspec-rails (5.1.2)
@@ -188,47 +198,51 @@ GEM
188
198
  rspec-expectations (~> 3.10)
189
199
  rspec-mocks (~> 3.10)
190
200
  rspec-support (~> 3.10)
191
- rspec-support (3.12.0)
192
- rubocop (1.52.1)
201
+ rspec-support (3.12.1)
202
+ rubocop (1.56.3)
203
+ base64 (~> 0.1.1)
193
204
  json (~> 2.3)
205
+ language_server-protocol (>= 3.17.0)
194
206
  parallel (~> 1.10)
195
207
  parser (>= 3.2.2.3)
196
208
  rainbow (>= 2.2.2, < 4.0)
197
209
  regexp_parser (>= 1.8, < 3.0)
198
210
  rexml (>= 3.2.5, < 4.0)
199
- rubocop-ast (>= 1.28.0, < 2.0)
211
+ rubocop-ast (>= 1.28.1, < 2.0)
200
212
  ruby-progressbar (~> 1.7)
201
213
  unicode-display_width (>= 2.4.0, < 3.0)
202
214
  rubocop-ast (1.29.0)
203
215
  parser (>= 3.2.1.0)
204
- rubocop-performance (1.18.0)
216
+ rubocop-performance (1.19.1)
205
217
  rubocop (>= 1.7.0, < 2.0)
206
218
  rubocop-ast (>= 0.4.0)
207
219
  ruby-progressbar (1.13.0)
208
220
  safely_block (0.4.0)
209
- sprockets (4.2.0)
221
+ sprockets (4.2.1)
210
222
  concurrent-ruby (~> 1.0)
211
223
  rack (>= 2.2.4, < 4)
212
224
  sprockets-rails (3.2.2)
213
225
  actionpack (>= 4.0)
214
226
  activesupport (>= 4.0)
215
227
  sprockets (>= 3.0.0)
216
- sqlite3 (1.6.3-aarch64-linux)
217
- sqlite3 (1.6.3-x86_64-darwin)
218
- sqlite3 (1.6.3-x86_64-linux)
219
- standard (1.29.0)
228
+ sqlite3 (1.6.6-aarch64-linux)
229
+ sqlite3 (1.6.6-x86_64-darwin)
230
+ sqlite3 (1.6.6-x86_64-linux)
231
+ standard (1.31.1)
220
232
  language_server-protocol (~> 3.17.0.2)
221
233
  lint_roller (~> 1.0)
222
- rubocop (~> 1.52.0)
234
+ rubocop (~> 1.56.2)
223
235
  standard-custom (~> 1.0.0)
224
- standard-performance (~> 1.1.0)
225
- standard-custom (1.0.1)
226
- lint_roller (~> 1.0)
227
- standard-performance (1.1.0)
236
+ standard-performance (~> 1.2)
237
+ standard-custom (1.0.2)
228
238
  lint_roller (~> 1.0)
229
- rubocop-performance (~> 1.18.0)
239
+ rubocop (~> 1.50)
240
+ standard-performance (1.2.0)
241
+ lint_roller (~> 1.1)
242
+ rubocop-performance (~> 1.19.0)
243
+ stringio (3.0.8)
230
244
  thor (1.2.2)
231
- timeout (0.3.2)
245
+ timeout (0.4.0)
232
246
  tzinfo (2.0.6)
233
247
  concurrent-ruby (~> 1.0)
234
248
  unicode-display_width (2.4.2)
@@ -236,10 +250,10 @@ GEM
236
250
  activesupport (>= 5.2.0, < 8.0)
237
251
  concurrent-ruby (~> 1.0)
238
252
  method_source (~> 1.0)
239
- websocket-driver (0.7.5)
253
+ websocket-driver (0.7.6)
240
254
  websocket-extensions (>= 0.1.0)
241
255
  websocket-extensions (0.1.5)
242
- zeitwerk (2.6.8)
256
+ zeitwerk (2.6.12)
243
257
 
244
258
  PLATFORMS
245
259
  aarch64-linux
data/README.md CHANGED
@@ -65,7 +65,7 @@ bundle install --gemfile spec/sample/Gemfile
65
65
  # run test cases and ensure everything is passing
66
66
  rake spec
67
67
 
68
- # an interactive prompt that will allow you to experiment with matey (currently broken!)
68
+ # an interactive prompt that will allow you to experiment with matey
69
69
  bin/console
70
70
  ```
71
71
 
@@ -1,8 +1,8 @@
1
1
  <div class="card <%= @color_scheme %>">
2
2
  <div class="card-header">
3
3
  <h5>Visits By Day of Week since <%= time_ago_in_words(@time_window.ago).titleize %> Ago (<%= @time_window.ago.strftime("%m/%d/%Y") %>) </h5>
4
- <% if @exclude_days %>
5
- <p>Excluding <%= @exclude_days%>
4
+ <% if @exclude_days.any? %>
5
+ <p>Excluding <%= @exclude_days.join(', ') %></p>
6
6
  <% end %>
7
7
  </div>
8
8
  <div class="card-body">
@@ -14,7 +14,7 @@
14
14
  </tr>
15
15
  </thead>
16
16
  <tbody class="text-dark border-dark">
17
- <% @visits_by_day_of_week.each do |day_of_week, count| %>
17
+ <% visits_by_day_of_week.each do |day_of_week, count| %>
18
18
  <tr>
19
19
  <td><%= day_of_week %></td>
20
20
  <td class="text-end"><%= count %></td>
@@ -1,24 +1,17 @@
1
1
  require "ahoy_matey"
2
+ require "groupdate"
2
3
 
3
4
  class Matey::VisitsByDayOfWeekComponent < Matey::ApplicationComponent
4
- def initialize(visits:, time_window: 1.month, limit: 10, exclude_days: [], color_scheme: "neutral")
5
+ def initialize(visits:, time_window: 1.month, exclude_days: [], color_scheme: "neutral")
6
+ @visits = visits
5
7
  @time_window = time_window
6
-
7
- # query for all the visits
8
- all_visits = visits.where(started_at: time_window.ago..)
9
-
10
- visits_by_day_of_week = {}
11
-
12
- # get day of week from each visit. Incrase value of dayOfWeek key by 1 if key is already there else initialize key with value of 1
13
- all_visits.each { |visit| visits_by_day_of_week.key?(visit.started_at.strftime("%A")) ? visits_by_day_of_week[(visit.started_at.strftime("%A"))] += 1 : visits_by_day_of_week[visit.started_at.strftime("%A")] = 1 }
14
-
15
- # take out items from visits_by_day_of_week hashmap based on exclude_days parameter
16
- if exclude_days.length > 0
17
- exclude_days.each { |exclude| visits_by_day_of_week = visits_by_day_of_week.slice!(exclude) }
18
- end
19
-
20
- @visits_by_day_of_week = visits_by_day_of_week
21
-
8
+ @exclude_days = exclude_days
22
9
  @color_scheme = color_scheme(scheme: color_scheme)
23
10
  end
11
+
12
+ # group visits by day in provided time window
13
+ def visits_by_day_of_week
14
+ visits_by_day_of_week = @visits.group_by_day_of_week(:started_at, format: "%A", range: @time_window.ago..).count
15
+ visits_by_day_of_week.except!(*@exclude_days) if @exclude_days.any?
16
+ end
24
17
  end
data/lib/matey/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Matey
4
- VERSION = "0.1.4"
4
+ VERSION = "0.1.6"
5
5
  end
data/matey.gemspec CHANGED
@@ -35,7 +35,8 @@ Gem::Specification.new do |spec|
35
35
  spec.require_paths = ["lib"]
36
36
 
37
37
  spec.add_dependency "view_component", "~> 2.74"
38
- spec.add_dependency "ahoy_matey", "~> 4.0"
38
+ spec.add_dependency "ahoy_matey", ">= 4.0"
39
+ spec.add_dependency "groupdate", "~> 6.4.0"
39
40
 
40
41
  spec.add_development_dependency "rspec-rails", "~> 5.0"
41
42
  spec.add_development_dependency "factory_bot_rails", "~> 6.0"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: matey
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Loos
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2023-06-21 00:00:00.000000000 Z
12
+ date: 2023-12-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: view_component
@@ -29,16 +29,30 @@ dependencies:
29
29
  name: ahoy_matey
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - "~>"
32
+ - - ">="
33
33
  - !ruby/object:Gem::Version
34
34
  version: '4.0'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - "~>"
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  version: '4.0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: groupdate
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: 6.4.0
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: 6.4.0
42
56
  - !ruby/object:Gem::Dependency
43
57
  name: rspec-rails
44
58
  requirement: !ruby/object:Gem::Requirement