discorb 0.19.0 → 0.20.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/build_version.yml +2 -2
  3. data/.rubocop.yml +12 -75
  4. data/Changelog.md +10 -0
  5. data/Rakefile +482 -454
  6. data/lib/discorb/allowed_mentions.rb +68 -72
  7. data/lib/discorb/app_command/command.rb +466 -398
  8. data/lib/discorb/app_command/common.rb +65 -25
  9. data/lib/discorb/app_command/handler.rb +304 -266
  10. data/lib/discorb/app_command.rb +5 -5
  11. data/lib/discorb/application.rb +198 -197
  12. data/lib/discorb/asset.rb +101 -101
  13. data/lib/discorb/attachment.rb +134 -119
  14. data/lib/discorb/audit_logs.rb +412 -385
  15. data/lib/discorb/automod.rb +279 -269
  16. data/lib/discorb/channel/base.rb +107 -108
  17. data/lib/discorb/channel/category.rb +32 -32
  18. data/lib/discorb/channel/container.rb +44 -44
  19. data/lib/discorb/channel/dm.rb +26 -28
  20. data/lib/discorb/channel/guild.rb +311 -246
  21. data/lib/discorb/channel/stage.rb +156 -140
  22. data/lib/discorb/channel/text.rb +430 -336
  23. data/lib/discorb/channel/thread.rb +374 -325
  24. data/lib/discorb/channel/voice.rb +85 -79
  25. data/lib/discorb/channel.rb +5 -5
  26. data/lib/discorb/client.rb +635 -621
  27. data/lib/discorb/color.rb +178 -182
  28. data/lib/discorb/common.rb +168 -164
  29. data/lib/discorb/components/button.rb +107 -106
  30. data/lib/discorb/components/select_menu.rb +157 -145
  31. data/lib/discorb/components/text_input.rb +103 -106
  32. data/lib/discorb/components.rb +68 -66
  33. data/lib/discorb/dictionary.rb +135 -135
  34. data/lib/discorb/embed.rb +404 -398
  35. data/lib/discorb/emoji.rb +309 -302
  36. data/lib/discorb/emoji_table.rb +16099 -8857
  37. data/lib/discorb/error.rb +131 -131
  38. data/lib/discorb/event.rb +360 -314
  39. data/lib/discorb/event_handler.rb +39 -39
  40. data/lib/discorb/exe/about.rb +17 -17
  41. data/lib/discorb/exe/irb.rb +72 -67
  42. data/lib/discorb/exe/new.rb +323 -315
  43. data/lib/discorb/exe/run.rb +69 -68
  44. data/lib/discorb/exe/setup.rb +57 -55
  45. data/lib/discorb/exe/show.rb +12 -12
  46. data/lib/discorb/extend.rb +25 -45
  47. data/lib/discorb/extension.rb +89 -83
  48. data/lib/discorb/flag.rb +126 -128
  49. data/lib/discorb/gateway.rb +984 -804
  50. data/lib/discorb/gateway_events.rb +670 -638
  51. data/lib/discorb/gateway_requests.rb +45 -48
  52. data/lib/discorb/guild.rb +2115 -1626
  53. data/lib/discorb/guild_template.rb +280 -241
  54. data/lib/discorb/http.rb +247 -232
  55. data/lib/discorb/image.rb +42 -42
  56. data/lib/discorb/integration.rb +169 -161
  57. data/lib/discorb/intents.rb +161 -163
  58. data/lib/discorb/interaction/autocomplete.rb +76 -62
  59. data/lib/discorb/interaction/command.rb +279 -224
  60. data/lib/discorb/interaction/components.rb +114 -104
  61. data/lib/discorb/interaction/modal.rb +36 -32
  62. data/lib/discorb/interaction/response.rb +379 -336
  63. data/lib/discorb/interaction/root.rb +271 -257
  64. data/lib/discorb/interaction.rb +5 -5
  65. data/lib/discorb/invite.rb +154 -153
  66. data/lib/discorb/member.rb +344 -311
  67. data/lib/discorb/message.rb +615 -544
  68. data/lib/discorb/message_meta.rb +197 -186
  69. data/lib/discorb/modules.rb +371 -290
  70. data/lib/discorb/permission.rb +305 -291
  71. data/lib/discorb/presence.rb +352 -346
  72. data/lib/discorb/rate_limit.rb +81 -76
  73. data/lib/discorb/reaction.rb +55 -54
  74. data/lib/discorb/role.rb +272 -240
  75. data/lib/discorb/shard.rb +76 -74
  76. data/lib/discorb/sticker.rb +193 -171
  77. data/lib/discorb/user.rb +205 -188
  78. data/lib/discorb/utils/colored_puts.rb +16 -16
  79. data/lib/discorb/utils.rb +12 -16
  80. data/lib/discorb/voice_state.rb +305 -281
  81. data/lib/discorb/webhook.rb +537 -507
  82. data/lib/discorb.rb +62 -56
  83. data/sig/discorb/application.rbs +2 -0
  84. data/sig/discorb/automod.rbs +10 -1
  85. data/sig/discorb/guild.rbs +2 -0
  86. data/sig/discorb/message.rbs +2 -0
  87. data/sig/discorb/user.rbs +22 -20
  88. metadata +2 -2
@@ -1,291 +1,305 @@
1
- # frozen_string_literal: true
2
-
3
- module Discorb
4
- #
5
- # Represents a permission per guild.
6
- # ## Flag fields
7
- #
8
- # | Field | Value |
9
- # |-------|-------|
10
- # |`1 << 0`|`:create_instant_invite`|
11
- # |`1 << 1`|`:kick_members`|
12
- # |`1 << 2`|`:ban_members`|
13
- # |`1 << 3`|`:administrator`|
14
- # |`1 << 4`|`:manage_channels`|
15
- # |`1 << 5`|`:manage_guild`|
16
- # |`1 << 6`|`:add_reactions`|
17
- # |`1 << 7`|`:view_audit_log`|
18
- # |`1 << 8`|`:priority_speaker`|
19
- # |`1 << 9`|`:stream`|
20
- # |`1 << 10`|`:view_channel`|
21
- # |`1 << 11`|`:send_messages`|
22
- # |`1 << 12`|`:send_tts_messages`|
23
- # |`1 << 13`|`:manage_messages`|
24
- # |`1 << 14`|`:embed_links`|
25
- # |`1 << 15`|`:attach_files`|
26
- # |`1 << 16`|`:read_message_history`|
27
- # |`1 << 17`|`:mention_everyone`|
28
- # |`1 << 18`|`:use_external_emojis`|
29
- # |`1 << 19`|`:view_guild_insights`|
30
- # |`1 << 20`|`:connect`|
31
- # |`1 << 21`|`:speak`|
32
- # |`1 << 22`|`:mute_members`|
33
- # |`1 << 23`|`:deafen_members`|
34
- # |`1 << 24`|`:move_members`|
35
- # |`1 << 25`|`:use_vad`|
36
- # |`1 << 26`|`:change_nickname`|
37
- # |`1 << 27`|`:manage_nicknames`|
38
- # |`1 << 28`|`:manage_roles`|
39
- # |`1 << 29`|`:manage_webhooks`|
40
- # |`1 << 30`|`:manage_emojis`|
41
- # |`1 << 31`|`:use_slash_commands`|
42
- # |`1 << 32`|`:request_to_speak`|
43
- # |`1 << 34`|`:manage_threads`|
44
- # |`1 << 35`|`:use_public_threads`|
45
- # |`1 << 36`|`:use_private_threads`|
46
- #
47
- class Permission < Flag
48
- @bits = {
49
- create_instant_invite: 0,
50
- kick_members: 1,
51
- ban_members: 2,
52
- administrator: 3,
53
- manage_channels: 4,
54
- manage_guild: 5,
55
- add_reactions: 6,
56
- view_audit_log: 7,
57
- priority_speaker: 8,
58
- stream: 9,
59
- view_channel: 10,
60
- send_messages: 11,
61
- send_tts_messages: 12,
62
- manage_messages: 13,
63
- embed_links: 14,
64
- attach_files: 15,
65
- read_message_history: 16,
66
- mention_everyone: 17,
67
- use_external_emojis: 18,
68
- view_guild_insights: 19,
69
- connect: 20,
70
- speak: 21,
71
- mute_members: 22,
72
- deafen_members: 23,
73
- move_members: 24,
74
- use_vad: 25,
75
- change_nickname: 26,
76
- manage_nicknames: 27,
77
- manage_roles: 28,
78
- manage_webhooks: 29,
79
- manage_emojis: 30,
80
- use_slash_commands: 31,
81
- request_to_speak: 32,
82
- manage_threads: 34,
83
- use_public_threads: 35,
84
- use_private_threads: 36,
85
- }.freeze
86
- end
87
-
88
- #
89
- # Represents a permission per channel.
90
- #
91
- class PermissionOverwrite
92
- # @!attribute [r] allow
93
- # @return [Discorb::Permission] The allowed permissions.
94
- # @!attribute [r] deny
95
- # @return [Discorb::Permission] The denied permissions.
96
- # @!attribute [r] allow_value
97
- # @return [Integer] The allowed permissions as an integer.
98
- # @!attribute [r] deny_value
99
- # @return [Integer] The denied permissions as an integer.
100
-
101
- @raw_bits = {
102
- create_instant_invite: 0,
103
- kick_members: 1,
104
- ban_members: 2,
105
- administrator: 3,
106
- manage_channels: 4,
107
- manage_guild: 5,
108
- add_reactions: 6,
109
- view_audit_log: 7,
110
- priority_speaker: 8,
111
- stream: 9,
112
- view_channel: 10,
113
- send_messages: 11,
114
- send_tts_messages: 12,
115
- manage_messages: 13,
116
- embed_links: 14,
117
- attach_files: 15,
118
- read_message_history: 16,
119
- mention_everyone: 17,
120
- use_external_emojis: 18,
121
- view_guild_insights: 19,
122
- connect: 20,
123
- speak: 21,
124
- mute_members: 22,
125
- deafen_members: 23,
126
- move_members: 24,
127
- use_vad: 25,
128
- change_nickname: 26,
129
- manage_nicknames: 27,
130
- manage_roles: 28,
131
- manage_webhooks: 29,
132
- manage_emojis: 30,
133
- use_slash_commands: 31,
134
- request_to_speak: 32,
135
- manage_threads: 34,
136
- use_public_threads: 35,
137
- use_private_threads: 36,
138
- }.freeze
139
- @bits = @raw_bits.transform_values { |v| 1 << v }.freeze
140
-
141
- #
142
- # Initializes a new PermissionOverwrite.
143
- # @private
144
- #
145
- # @param allow [Integer] The allowed permissions.
146
- # @param deny [Integer] The denied permissions.
147
- #
148
- def initialize(allow, deny)
149
- @allow = allow
150
- @deny = deny
151
- end
152
-
153
- def allow
154
- self.class.bits.keys.filter { |field| @allow & self.class.bits[field] != 0 }
155
- end
156
-
157
- alias +@ allow
158
-
159
- def deny
160
- self.class.bits.keys.filter { |field| @deny & self.class.bits[field] != 0 }
161
- end
162
-
163
- alias -@ deny
164
-
165
- def allow_value
166
- @allow
167
- end
168
-
169
- def deny_value
170
- @deny
171
- end
172
-
173
- def inspect
174
- "#<#{self.class} allow=#{allow} deny=#{deny}>"
175
- end
176
-
177
- #
178
- # Converts the permission overwrite to a hash.
179
- #
180
- # @return [Hash] The permission overwrite as a hash.
181
- #
182
- def to_hash
183
- self.class.bits.keys.to_h do |field|
184
- [
185
- field,
186
- if @allow & self.class.bits[field] != 0
187
- true
188
- elsif @deny & self.class.bits[field] != 0
189
- false
190
- end,
191
- ]
192
- end
193
- end
194
-
195
- #
196
- # Union of the permission overwrites.
197
- #
198
- # @param [Discorb::PermissionOverwrite] other The other permission overwrite.
199
- #
200
- # @return [Discorb::PermissionOverwrite] The union of the permission overwrites.
201
- #
202
- def +(other)
203
- result = to_hash
204
- self.class.bits.each_key do |field|
205
- unless other[field].nil?
206
- result[field] = (other[field] || raise(KeyError, "field #{field} not found in #{other.inspect}"))
207
- end
208
- end
209
- self.class.from_hash(result)
210
- end
211
-
212
- #
213
- # Returns whether overwrite of the given field.
214
- #
215
- # @param [Symbol] field The field to check.
216
- #
217
- # @return [true, false, nil] Whether the field is allowed, denied or not set.
218
- #
219
- def [](field)
220
- if @allow & self.class.bits[field] != 0
221
- true
222
- elsif @deny & self.class.bits[field] != 0
223
- false
224
- end
225
- end
226
-
227
- #
228
- # Sets the given field to the given value.
229
- #
230
- # @param [Symbol] key The field to set.
231
- # @param [Boolean] bool The value to set.
232
- #
233
- def []=(key, bool)
234
- case bool
235
- when true
236
- @allow |= self.class.bits[key]
237
- @deny &= ~self.class.bits[key]
238
- when false
239
- @allow &= ~self.class.bits[key]
240
- @deny |= self.class.bits[key]
241
- else
242
- @allow &= ~self.class.bits[key]
243
- @deny &= ~self.class.bits[key]
244
- end
245
- end
246
-
247
- #
248
- # (see Flag#method_missing)
249
- #
250
- def method_missing(method, bool = nil)
251
- if self.class.bits.key?(method)
252
- self[method]
253
- elsif self.class.bits.key?(method.to_s.delete_suffix("=").to_sym)
254
- key = method.to_s.delete_suffix("=").to_sym
255
- self[key] = bool
256
- else
257
- super
258
- end
259
- end
260
-
261
- def respond_to_missing?(method, _arg)
262
- self.class.bits.key?(method.to_s.delete_suffix("=").to_sym) ? true : super
263
- end
264
-
265
- class << self
266
- # @private
267
- attr_reader :bits
268
-
269
- #
270
- # Initializes a permission overwrite from a hash.
271
- #
272
- # @param [Hash] hash The hash to initialize the permission overwrite from.
273
- #
274
- # @return [Discorb::PermissionOverwrite] The permission overwrite.
275
- #
276
- def from_hash(hash)
277
- allow = 0
278
- deny = 0
279
- hash.filter { |k, v| self.class.bits.keys.include?(k) && [true, false].include?(v) }.each do |k, v|
280
- if v
281
- allow += self.class.bits[k]
282
- else
283
- deny += self.class.bits[k]
284
- end
285
- end
286
-
287
- new(allow, deny)
288
- end
289
- end
290
- end
291
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Discorb
4
+ #
5
+ # Represents a permission per guild.
6
+ # ## Flag fields
7
+ #
8
+ # | Field | Value |
9
+ # |-------|-------|
10
+ # |`1 << 0`|`:create_instant_invite`|
11
+ # |`1 << 1`|`:kick_members`|
12
+ # |`1 << 2`|`:ban_members`|
13
+ # |`1 << 3`|`:administrator`|
14
+ # |`1 << 4`|`:manage_channels`|
15
+ # |`1 << 5`|`:manage_guild`|
16
+ # |`1 << 6`|`:add_reactions`|
17
+ # |`1 << 7`|`:view_audit_log`|
18
+ # |`1 << 8`|`:priority_speaker`|
19
+ # |`1 << 9`|`:stream`|
20
+ # |`1 << 10`|`:view_channel`|
21
+ # |`1 << 11`|`:send_messages`|
22
+ # |`1 << 12`|`:send_tts_messages`|
23
+ # |`1 << 13`|`:manage_messages`|
24
+ # |`1 << 14`|`:embed_links`|
25
+ # |`1 << 15`|`:attach_files`|
26
+ # |`1 << 16`|`:read_message_history`|
27
+ # |`1 << 17`|`:mention_everyone`|
28
+ # |`1 << 18`|`:use_external_emojis`|
29
+ # |`1 << 19`|`:view_guild_insights`|
30
+ # |`1 << 20`|`:connect`|
31
+ # |`1 << 21`|`:speak`|
32
+ # |`1 << 22`|`:mute_members`|
33
+ # |`1 << 23`|`:deafen_members`|
34
+ # |`1 << 24`|`:move_members`|
35
+ # |`1 << 25`|`:use_vad`|
36
+ # |`1 << 26`|`:change_nickname`|
37
+ # |`1 << 27`|`:manage_nicknames`|
38
+ # |`1 << 28`|`:manage_roles`|
39
+ # |`1 << 29`|`:manage_webhooks`|
40
+ # |`1 << 30`|`:manage_emojis`|
41
+ # |`1 << 31`|`:use_slash_commands`|
42
+ # |`1 << 32`|`:request_to_speak`|
43
+ # |`1 << 34`|`:manage_threads`|
44
+ # |`1 << 35`|`:use_public_threads`|
45
+ # |`1 << 36`|`:use_private_threads`|
46
+ #
47
+ class Permission < Flag
48
+ @bits = {
49
+ create_instant_invite: 0,
50
+ kick_members: 1,
51
+ ban_members: 2,
52
+ administrator: 3,
53
+ manage_channels: 4,
54
+ manage_guild: 5,
55
+ add_reactions: 6,
56
+ view_audit_log: 7,
57
+ priority_speaker: 8,
58
+ stream: 9,
59
+ view_channel: 10,
60
+ send_messages: 11,
61
+ send_tts_messages: 12,
62
+ manage_messages: 13,
63
+ embed_links: 14,
64
+ attach_files: 15,
65
+ read_message_history: 16,
66
+ mention_everyone: 17,
67
+ use_external_emojis: 18,
68
+ view_guild_insights: 19,
69
+ connect: 20,
70
+ speak: 21,
71
+ mute_members: 22,
72
+ deafen_members: 23,
73
+ move_members: 24,
74
+ use_vad: 25,
75
+ change_nickname: 26,
76
+ manage_nicknames: 27,
77
+ manage_roles: 28,
78
+ manage_webhooks: 29,
79
+ manage_emojis: 30,
80
+ use_slash_commands: 31,
81
+ request_to_speak: 32,
82
+ manage_threads: 34,
83
+ use_public_threads: 35,
84
+ use_private_threads: 36,
85
+ use_external_stickers: 37,
86
+ send_messages_in_threads: 38,
87
+ use_embedded_activities: 39,
88
+ moderate_members: 40
89
+ }.freeze
90
+ end
91
+
92
+ #
93
+ # Represents a permission per channel.
94
+ #
95
+ class PermissionOverwrite
96
+ # @!attribute [r] allow
97
+ # @return [Discorb::Permission] The allowed permissions.
98
+ # @!attribute [r] deny
99
+ # @return [Discorb::Permission] The denied permissions.
100
+ # @!attribute [r] allow_value
101
+ # @return [Integer] The allowed permissions as an integer.
102
+ # @!attribute [r] deny_value
103
+ # @return [Integer] The denied permissions as an integer.
104
+
105
+ @raw_bits = {
106
+ create_instant_invite: 0,
107
+ kick_members: 1,
108
+ ban_members: 2,
109
+ administrator: 3,
110
+ manage_channels: 4,
111
+ manage_guild: 5,
112
+ add_reactions: 6,
113
+ view_audit_log: 7,
114
+ priority_speaker: 8,
115
+ stream: 9,
116
+ view_channel: 10,
117
+ send_messages: 11,
118
+ send_tts_messages: 12,
119
+ manage_messages: 13,
120
+ embed_links: 14,
121
+ attach_files: 15,
122
+ read_message_history: 16,
123
+ mention_everyone: 17,
124
+ use_external_emojis: 18,
125
+ view_guild_insights: 19,
126
+ connect: 20,
127
+ speak: 21,
128
+ mute_members: 22,
129
+ deafen_members: 23,
130
+ move_members: 24,
131
+ use_vad: 25,
132
+ change_nickname: 26,
133
+ manage_nicknames: 27,
134
+ manage_roles: 28,
135
+ manage_webhooks: 29,
136
+ manage_emojis: 30,
137
+ use_slash_commands: 31,
138
+ request_to_speak: 32,
139
+ manage_threads: 34,
140
+ use_public_threads: 35,
141
+ use_private_threads: 36
142
+ }.freeze
143
+ @bits = @raw_bits.transform_values { |v| 1 << v }.freeze
144
+
145
+ #
146
+ # Initializes a new PermissionOverwrite.
147
+ # @private
148
+ #
149
+ # @param allow [Integer] The allowed permissions.
150
+ # @param deny [Integer] The denied permissions.
151
+ #
152
+ def initialize(allow, deny)
153
+ @allow = allow
154
+ @deny = deny
155
+ end
156
+
157
+ def allow
158
+ self.class.bits.keys.filter do |field|
159
+ @allow & self.class.bits[field] != 0
160
+ end
161
+ end
162
+
163
+ alias +@ allow
164
+
165
+ def deny
166
+ self.class.bits.keys.filter do |field|
167
+ @deny & self.class.bits[field] != 0
168
+ end
169
+ end
170
+
171
+ alias -@ deny
172
+
173
+ def allow_value
174
+ @allow
175
+ end
176
+
177
+ def deny_value
178
+ @deny
179
+ end
180
+
181
+ def inspect
182
+ "#<#{self.class} allow=#{allow} deny=#{deny}>"
183
+ end
184
+
185
+ #
186
+ # Converts the permission overwrite to a hash.
187
+ #
188
+ # @return [Hash] The permission overwrite as a hash.
189
+ #
190
+ def to_hash
191
+ self.class.bits.keys.to_h do |field|
192
+ [
193
+ field,
194
+ if @allow & self.class.bits[field] != 0
195
+ true
196
+ elsif @deny & self.class.bits[field] != 0
197
+ false
198
+ end
199
+ ]
200
+ end
201
+ end
202
+
203
+ #
204
+ # Union of the permission overwrites.
205
+ #
206
+ # @param [Discorb::PermissionOverwrite] other The other permission overwrite.
207
+ #
208
+ # @return [Discorb::PermissionOverwrite] The union of the permission overwrites.
209
+ #
210
+ def +(other)
211
+ result = to_hash
212
+ self.class.bits.each_key do |field|
213
+ next if other[field].nil?
214
+ result[field] = (
215
+ other[field] ||
216
+ raise(KeyError, "field #{field} not found in #{other.inspect}")
217
+ )
218
+ end
219
+ self.class.from_hash(result)
220
+ end
221
+
222
+ #
223
+ # Returns whether overwrite of the given field.
224
+ #
225
+ # @param [Symbol] field The field to check.
226
+ #
227
+ # @return [true, false, nil] Whether the field is allowed, denied or not set.
228
+ #
229
+ def [](field)
230
+ if @allow & self.class.bits[field] != 0
231
+ true
232
+ elsif @deny & self.class.bits[field] != 0
233
+ false
234
+ end
235
+ end
236
+
237
+ #
238
+ # Sets the given field to the given value.
239
+ #
240
+ # @param [Symbol] key The field to set.
241
+ # @param [Boolean] bool The value to set.
242
+ #
243
+ def []=(key, bool)
244
+ case bool
245
+ when true
246
+ @allow |= self.class.bits[key]
247
+ @deny &= ~self.class.bits[key]
248
+ when false
249
+ @allow &= ~self.class.bits[key]
250
+ @deny |= self.class.bits[key]
251
+ else
252
+ @allow &= ~self.class.bits[key]
253
+ @deny &= ~self.class.bits[key]
254
+ end
255
+ end
256
+
257
+ #
258
+ # (see Flag#method_missing)
259
+ #
260
+ def method_missing(method, bool = nil)
261
+ if self.class.bits.key?(method)
262
+ self[method]
263
+ elsif self.class.bits.key?(method.to_s.delete_suffix("=").to_sym)
264
+ key = method.to_s.delete_suffix("=").to_sym
265
+ self[key] = bool
266
+ else
267
+ super
268
+ end
269
+ end
270
+
271
+ def respond_to_missing?(method, _arg)
272
+ self.class.bits.key?(method.to_s.delete_suffix("=").to_sym) ? true : super
273
+ end
274
+
275
+ class << self
276
+ # @private
277
+ attr_reader :bits
278
+
279
+ #
280
+ # Initializes a permission overwrite from a hash.
281
+ #
282
+ # @param [Hash] hash The hash to initialize the permission overwrite from.
283
+ #
284
+ # @return [Discorb::PermissionOverwrite] The permission overwrite.
285
+ #
286
+ def from_hash(hash)
287
+ allow = 0
288
+ deny = 0
289
+ hash
290
+ .filter do |k, v|
291
+ self.class.bits.keys.include?(k) && [true, false].include?(v)
292
+ end
293
+ .each do |k, v|
294
+ if v
295
+ allow += self.class.bits[k]
296
+ else
297
+ deny += self.class.bits[k]
298
+ end
299
+ end
300
+
301
+ new(allow, deny)
302
+ end
303
+ end
304
+ end
305
+ end