u-struct 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +5 -5
  3. data/.rubocop.yml +129 -0
  4. data/.rubocop_todo.yml +10 -0
  5. data/.tool-versions +1 -0
  6. data/CHANGELOG.md +115 -27
  7. data/Gemfile +14 -3
  8. data/README.md +166 -62
  9. data/Rakefile +5 -5
  10. data/bin/console +3 -3
  11. data/bin/prepare_coverage +7 -9
  12. data/bin/run_ci +17 -0
  13. data/bin/tapioca +28 -0
  14. data/examples/rgb/number.rb +1 -1
  15. data/examples/rgb_1.rb +3 -3
  16. data/examples/rgb_2.rb +2 -2
  17. data/examples/rgb_3.rb +1 -1
  18. data/lib/micro/struct/factory/create_struct.rb +12 -5
  19. data/lib/micro/struct/factory/members.rb +1 -0
  20. data/lib/micro/struct/factory.rb +10 -5
  21. data/lib/micro/struct/features.rb +18 -23
  22. data/lib/micro/struct/normalize_names.rb +4 -3
  23. data/lib/micro/struct/version.rb +2 -1
  24. data/lib/micro/struct.rb +32 -5
  25. data/lib/u-struct.rb +2 -0
  26. data/rbi/micro/struct/factory/create_struct.rbi +60 -0
  27. data/rbi/micro/struct/factory/members.rbi +67 -0
  28. data/rbi/micro/struct/factory.rbi +41 -0
  29. data/rbi/micro/struct/features.rbi +41 -0
  30. data/rbi/micro/struct/normalize_names.rbi +20 -0
  31. data/rbi/micro/struct/version.rbi +3 -0
  32. data/rbi/micro/struct.rbi +68 -0
  33. data/sorbet/config +8 -0
  34. data/sorbet/rbi/gems/ast@2.4.2.rbi +54 -0
  35. data/sorbet/rbi/gems/coderay@1.1.3.rbi +8 -0
  36. data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +11 -0
  37. data/sorbet/rbi/gems/docile@1.4.0.rbi +54 -0
  38. data/sorbet/rbi/gems/method_source@1.0.0.rbi +8 -0
  39. data/sorbet/rbi/gems/minitest@5.15.0.rbi +345 -0
  40. data/sorbet/rbi/gems/parser@3.1.0.0.rbi +1196 -0
  41. data/sorbet/rbi/gems/pry@0.14.1.rbi +8 -0
  42. data/sorbet/rbi/gems/rake@13.0.6.rbi +806 -0
  43. data/sorbet/rbi/gems/rbi@0.0.9.rbi +1602 -0
  44. data/sorbet/rbi/gems/simplecov-html@0.12.3.rbi +89 -0
  45. data/sorbet/rbi/gems/simplecov@0.21.2.rbi +577 -0
  46. data/sorbet/rbi/gems/simplecov_json_formatter@0.1.3.rbi +8 -0
  47. data/sorbet/rbi/gems/spoom@1.1.8.rbi +1252 -0
  48. data/sorbet/rbi/gems/tapioca@0.6.2.rbi +1232 -0
  49. data/sorbet/rbi/gems/thor@1.2.1.rbi +844 -0
  50. data/sorbet/rbi/gems/unparser@0.6.3.rbi +8 -0
  51. data/sorbet/rbi/gems/webrick@1.7.0.rbi +601 -0
  52. data/sorbet/rbi/gems/yard-sorbet@0.6.1.rbi +199 -0
  53. data/sorbet/rbi/gems/yard@0.9.27.rbi +4112 -0
  54. data/sorbet/tapioca/config.yml +13 -0
  55. data/sorbet/tapioca/require.rb +4 -0
  56. data/u-struct.gemspec +3 -3
  57. metadata +37 -3
  58. data/bin/test +0 -8
@@ -0,0 +1,8 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `unparser` gem.
5
+ # Please instead update this file by running `bin/tapioca gem unparser`.
6
+
7
+ # THIS IS AN EMPTY RBI FILE.
8
+ # see https://github.com/Shopify/tapioca/wiki/Manual-Gem-Requires
@@ -0,0 +1,601 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `webrick` gem.
5
+ # Please instead update this file by running `bin/tapioca gem webrick`.
6
+
7
+ module WEBrick::AccessLog
8
+ private
9
+
10
+ def escape(data); end
11
+ def format(format_string, params); end
12
+ def setup_params(config, req, res); end
13
+
14
+ class << self
15
+ def escape(data); end
16
+ def format(format_string, params); end
17
+ def setup_params(config, req, res); end
18
+ end
19
+ end
20
+
21
+ class WEBrick::BasicLog
22
+ def initialize(log_file = T.unsafe(nil), level = T.unsafe(nil)); end
23
+
24
+ def <<(obj); end
25
+ def close; end
26
+ def debug(msg); end
27
+ def debug?; end
28
+ def error(msg); end
29
+ def error?; end
30
+ def fatal(msg); end
31
+ def fatal?; end
32
+ def info(msg); end
33
+ def info?; end
34
+ def level; end
35
+ def level=(_arg0); end
36
+ def log(level, data); end
37
+ def warn(msg); end
38
+ def warn?; end
39
+
40
+ private
41
+
42
+ def format(arg); end
43
+ end
44
+
45
+ class WEBrick::GenericServer
46
+ def initialize(config = T.unsafe(nil), default = T.unsafe(nil)); end
47
+
48
+ def [](key); end
49
+ def config; end
50
+ def listen(address, port); end
51
+ def listeners; end
52
+ def logger; end
53
+ def run(sock); end
54
+ def shutdown; end
55
+ def start(&block); end
56
+ def status; end
57
+ def stop; end
58
+ def tokens; end
59
+
60
+ private
61
+
62
+ def accept_client(svr); end
63
+ def alarm_shutdown_pipe; end
64
+ def call_callback(callback_name, *args); end
65
+ def cleanup_listener; end
66
+ def cleanup_shutdown_pipe(shutdown_pipe); end
67
+ def setup_shutdown_pipe; end
68
+ def start_thread(sock, &block); end
69
+ end
70
+
71
+ module WEBrick::HTMLUtils
72
+ private
73
+
74
+ def escape(string); end
75
+
76
+ class << self
77
+ def escape(string); end
78
+ end
79
+ end
80
+
81
+ module WEBrick::HTTPAuth
82
+ private
83
+
84
+ def _basic_auth(req, res, realm, req_field, res_field, err_type, block); end
85
+ def basic_auth(req, res, realm, &block); end
86
+ def proxy_basic_auth(req, res, realm, &block); end
87
+
88
+ class << self
89
+ def _basic_auth(req, res, realm, req_field, res_field, err_type, block); end
90
+ def basic_auth(req, res, realm, &block); end
91
+ def proxy_basic_auth(req, res, realm, &block); end
92
+ end
93
+ end
94
+
95
+ module WEBrick::HTTPAuth::Authenticator
96
+ def logger; end
97
+ def realm; end
98
+ def userdb; end
99
+
100
+ private
101
+
102
+ def check_init(config); end
103
+ def check_scheme(req); end
104
+ def error(fmt, *args); end
105
+ def info(fmt, *args); end
106
+ def log(meth, fmt, *args); end
107
+ end
108
+
109
+ WEBrick::HTTPAuth::Authenticator::AuthException = WEBrick::HTTPStatus::Unauthorized
110
+
111
+ class WEBrick::HTTPAuth::BasicAuth
112
+ include ::WEBrick::HTTPAuth::Authenticator
113
+
114
+ def initialize(config, default = T.unsafe(nil)); end
115
+
116
+ def authenticate(req, res); end
117
+ def challenge(req, res); end
118
+ def logger; end
119
+ def realm; end
120
+ def userdb; end
121
+
122
+ class << self
123
+ def make_passwd(realm, user, pass); end
124
+ end
125
+ end
126
+
127
+ class WEBrick::HTTPAuth::DigestAuth
128
+ include ::WEBrick::HTTPAuth::Authenticator
129
+
130
+ def initialize(config, default = T.unsafe(nil)); end
131
+
132
+ def algorithm; end
133
+ def authenticate(req, res); end
134
+ def challenge(req, res, stale = T.unsafe(nil)); end
135
+ def qop; end
136
+
137
+ private
138
+
139
+ def _authenticate(req, res); end
140
+ def check_nonce(req, auth_req); end
141
+ def check_opaque(opaque_struct, req, auth_req); end
142
+ def check_uri(req, auth_req); end
143
+ def generate_next_nonce(req); end
144
+ def generate_opaque(req); end
145
+ def hexdigest(*args); end
146
+ def split_param_value(string); end
147
+
148
+ class << self
149
+ def make_passwd(realm, user, pass); end
150
+ end
151
+ end
152
+
153
+ class WEBrick::HTTPAuth::DigestAuth::OpaqueInfo < ::Struct
154
+ def nc=(_); end
155
+ def nonce=(_); end
156
+ def time=(_); end
157
+ end
158
+
159
+ class WEBrick::HTTPAuth::Htdigest
160
+ include ::WEBrick::HTTPAuth::UserDB
161
+
162
+ def initialize(path); end
163
+
164
+ def delete_passwd(realm, user); end
165
+ def each; end
166
+ def flush(output = T.unsafe(nil)); end
167
+ def get_passwd(realm, user, reload_db); end
168
+ def reload; end
169
+ def set_passwd(realm, user, pass); end
170
+ end
171
+
172
+ class WEBrick::HTTPAuth::Htgroup
173
+ def initialize(path); end
174
+
175
+ def add(group, members); end
176
+ def flush(output = T.unsafe(nil)); end
177
+ def members(group); end
178
+ def reload; end
179
+ end
180
+
181
+ class WEBrick::HTTPAuth::Htpasswd
182
+ include ::WEBrick::HTTPAuth::UserDB
183
+
184
+ def initialize(path, password_hash: T.unsafe(nil)); end
185
+
186
+ def delete_passwd(realm, user); end
187
+ def each; end
188
+ def flush(output = T.unsafe(nil)); end
189
+ def get_passwd(realm, user, reload_db); end
190
+ def reload; end
191
+ def set_passwd(realm, user, pass); end
192
+ end
193
+
194
+ WEBrick::HTTPAuth::ProxyAuthenticator::AuthException = WEBrick::HTTPStatus::ProxyAuthenticationRequired
195
+
196
+ class WEBrick::HTTPAuth::ProxyBasicAuth < ::WEBrick::HTTPAuth::BasicAuth
197
+ include ::WEBrick::HTTPAuth::ProxyAuthenticator
198
+ end
199
+
200
+ class WEBrick::HTTPAuth::ProxyDigestAuth < ::WEBrick::HTTPAuth::DigestAuth
201
+ include ::WEBrick::HTTPAuth::ProxyAuthenticator
202
+
203
+ private
204
+
205
+ def check_uri(req, auth_req); end
206
+ end
207
+
208
+ module WEBrick::HTTPAuth::UserDB
209
+ def auth_type; end
210
+ def auth_type=(_arg0); end
211
+ def get_passwd(realm, user, reload_db = T.unsafe(nil)); end
212
+ def make_passwd(realm, user, pass); end
213
+ def set_passwd(realm, user, pass); end
214
+ end
215
+
216
+ class WEBrick::HTTPRequest
217
+ def initialize(config); end
218
+
219
+ def [](header_name); end
220
+ def accept; end
221
+ def accept_charset; end
222
+ def accept_encoding; end
223
+ def accept_language; end
224
+ def addr; end
225
+ def attributes; end
226
+ def body(&block); end
227
+ def body_reader; end
228
+ def content_length; end
229
+ def content_type; end
230
+ def continue; end
231
+ def cookies; end
232
+ def each; end
233
+ def fixup; end
234
+ def header; end
235
+ def host; end
236
+ def http_version; end
237
+ def keep_alive; end
238
+ def keep_alive?; end
239
+ def meta_vars; end
240
+ def parse(socket = T.unsafe(nil)); end
241
+ def path; end
242
+ def path_info; end
243
+ def path_info=(_arg0); end
244
+ def peeraddr; end
245
+ def port; end
246
+ def query; end
247
+ def query_string; end
248
+ def query_string=(_arg0); end
249
+ def raw_header; end
250
+ def readpartial(size, buf = T.unsafe(nil)); end
251
+ def remote_ip; end
252
+ def request_line; end
253
+ def request_method; end
254
+ def request_time; end
255
+ def request_uri; end
256
+ def script_name; end
257
+ def script_name=(_arg0); end
258
+ def server_name; end
259
+ def ssl?; end
260
+ def to_s; end
261
+ def unparsed_uri; end
262
+ def user; end
263
+ def user=(_arg0); end
264
+
265
+ private
266
+
267
+ def _read_data(io, method, *arg); end
268
+ def parse_query; end
269
+ def parse_uri(str, scheme = T.unsafe(nil)); end
270
+ def read_body(socket, block); end
271
+ def read_chunk_size(socket); end
272
+ def read_chunked(socket, block); end
273
+ def read_data(io, size); end
274
+ def read_header(socket); end
275
+ def read_line(io, size = T.unsafe(nil)); end
276
+ def read_request_line(socket); end
277
+ def setup_forwarded_info; end
278
+ end
279
+
280
+ WEBrick::HTTPRequest::MAX_HEADER_LENGTH = T.let(T.unsafe(nil), Integer)
281
+
282
+ class WEBrick::HTTPResponse
283
+ def initialize(config); end
284
+
285
+ def [](field); end
286
+ def []=(field, value); end
287
+ def body; end
288
+ def body=(_arg0); end
289
+ def chunked=(val); end
290
+ def chunked?; end
291
+ def config; end
292
+ def content_length; end
293
+ def content_length=(len); end
294
+ def content_type; end
295
+ def content_type=(type); end
296
+ def cookies; end
297
+ def each; end
298
+ def filename; end
299
+ def filename=(_arg0); end
300
+ def header; end
301
+ def http_version; end
302
+ def keep_alive; end
303
+ def keep_alive=(_arg0); end
304
+ def keep_alive?; end
305
+ def make_body_tempfile; end
306
+ def reason_phrase; end
307
+ def reason_phrase=(_arg0); end
308
+ def remove_body_tempfile; end
309
+ def request_http_version; end
310
+ def request_http_version=(_arg0); end
311
+ def request_method; end
312
+ def request_method=(_arg0); end
313
+ def request_uri; end
314
+ def request_uri=(_arg0); end
315
+ def send_body(socket); end
316
+ def send_header(socket); end
317
+ def send_response(socket); end
318
+ def sent_size; end
319
+ def set_error(ex, backtrace = T.unsafe(nil)); end
320
+ def set_redirect(status, url); end
321
+ def setup_header; end
322
+ def status; end
323
+ def status=(status); end
324
+ def status_line; end
325
+
326
+ private
327
+
328
+ def _write_data(socket, data); end
329
+ def check_header(header_value); end
330
+ def error_body(backtrace, ex, host, port); end
331
+ def send_body_io(socket); end
332
+ def send_body_proc(socket); end
333
+ def send_body_string(socket); end
334
+ end
335
+
336
+ class WEBrick::HTTPResponse::ChunkedWrapper
337
+ def initialize(socket, resp); end
338
+
339
+ def <<(*buf); end
340
+ def write(buf); end
341
+ end
342
+
343
+ class WEBrick::HTTPServer < ::WEBrick::GenericServer
344
+ def initialize(config = T.unsafe(nil), default = T.unsafe(nil)); end
345
+
346
+ def access_log(config, req, res); end
347
+ def create_request(with_webrick_config); end
348
+ def create_response(with_webrick_config); end
349
+ def do_OPTIONS(req, res); end
350
+ def lookup_server(req); end
351
+ def mount(dir, servlet, *options); end
352
+ def mount_proc(dir, proc = T.unsafe(nil), &block); end
353
+ def run(sock); end
354
+ def search_servlet(path); end
355
+ def service(req, res); end
356
+ def umount(dir); end
357
+ def unmount(dir); end
358
+ def virtual_host(server); end
359
+ end
360
+
361
+ class WEBrick::HTTPServer::MountTable
362
+ def initialize; end
363
+
364
+ def [](dir); end
365
+ def []=(dir, val); end
366
+ def delete(dir); end
367
+ def scan(path); end
368
+
369
+ private
370
+
371
+ def compile; end
372
+ def normalize(dir); end
373
+ end
374
+
375
+ class WEBrick::HTTPServlet::AbstractServlet
376
+ def initialize(server, *options); end
377
+
378
+ def do_GET(req, res); end
379
+ def do_HEAD(req, res); end
380
+ def do_OPTIONS(req, res); end
381
+ def service(req, res); end
382
+
383
+ private
384
+
385
+ def redirect_to_directory_uri(req, res); end
386
+
387
+ class << self
388
+ def get_instance(server, *options); end
389
+ end
390
+ end
391
+
392
+ class WEBrick::HTTPServlet::CGIHandler < ::WEBrick::HTTPServlet::AbstractServlet
393
+ def initialize(server, name); end
394
+
395
+ def do_GET(req, res); end
396
+ def do_POST(req, res); end
397
+ end
398
+
399
+ WEBrick::HTTPServlet::CGIHandler::CGIRunnerArray = T.let(T.unsafe(nil), Array)
400
+
401
+ class WEBrick::HTTPServlet::DefaultFileHandler < ::WEBrick::HTTPServlet::AbstractServlet
402
+ def initialize(server, local_path); end
403
+
404
+ def do_GET(req, res); end
405
+ def make_partial_content(req, res, filename, filesize); end
406
+ def multipart_body(body, parts, boundary, mtype, filesize); end
407
+ def not_modified?(req, res, mtime, etag); end
408
+ def prepare_range(range, filesize); end
409
+ end
410
+
411
+ class WEBrick::HTTPServlet::ERBHandler < ::WEBrick::HTTPServlet::AbstractServlet
412
+ def initialize(server, name); end
413
+
414
+ def do_GET(req, res); end
415
+ def do_POST(req, res); end
416
+
417
+ private
418
+
419
+ def evaluate(erb, servlet_request, servlet_response); end
420
+ end
421
+
422
+ class WEBrick::HTTPServlet::FileHandler < ::WEBrick::HTTPServlet::AbstractServlet
423
+ def initialize(server, root, options = T.unsafe(nil), default = T.unsafe(nil)); end
424
+
425
+ def do_GET(req, res); end
426
+ def do_OPTIONS(req, res); end
427
+ def do_POST(req, res); end
428
+ def service(req, res); end
429
+ def set_filesystem_encoding(str); end
430
+
431
+ private
432
+
433
+ def call_callback(callback_name, req, res); end
434
+ def check_filename(req, res, name); end
435
+ def exec_handler(req, res); end
436
+ def get_handler(req, res); end
437
+ def nondisclosure_name?(name); end
438
+ def prevent_directory_traversal(req, res); end
439
+ def search_file(req, res, basename); end
440
+ def search_index_file(req, res); end
441
+ def set_dir_list(req, res); end
442
+ def set_filename(req, res); end
443
+ def shift_path_info(req, res, path_info, base = T.unsafe(nil)); end
444
+ def trailing_pathsep?(path); end
445
+ def windows_ambiguous_name?(name); end
446
+
447
+ class << self
448
+ def add_handler(suffix, handler); end
449
+ def remove_handler(suffix); end
450
+ end
451
+ end
452
+
453
+ module WEBrick::HTTPStatus
454
+ private
455
+
456
+ def client_error?(code); end
457
+ def error?(code); end
458
+ def info?(code); end
459
+ def reason_phrase(code); end
460
+ def redirect?(code); end
461
+ def server_error?(code); end
462
+ def success?(code); end
463
+
464
+ class << self
465
+ def [](code); end
466
+ def client_error?(code); end
467
+ def error?(code); end
468
+ def info?(code); end
469
+ def reason_phrase(code); end
470
+ def redirect?(code); end
471
+ def server_error?(code); end
472
+ def success?(code); end
473
+ end
474
+ end
475
+
476
+ class WEBrick::HTTPStatus::Status < ::StandardError
477
+ def code; end
478
+ def reason_phrase; end
479
+ def to_i; end
480
+
481
+ class << self
482
+ def code; end
483
+ def reason_phrase; end
484
+ end
485
+ end
486
+
487
+ module WEBrick::HTTPUtils
488
+ private
489
+
490
+ def _escape(str, regex); end
491
+ def _make_regex(str); end
492
+ def _make_regex!(str); end
493
+ def _unescape(str, regex); end
494
+ def dequote(str); end
495
+ def escape(str); end
496
+ def escape8bit(str); end
497
+ def escape_form(str); end
498
+ def escape_path(str); end
499
+ def load_mime_types(file); end
500
+ def mime_type(filename, mime_tab); end
501
+ def normalize_path(path); end
502
+ def parse_form_data(io, boundary); end
503
+ def parse_header(raw); end
504
+ def parse_query(str); end
505
+ def parse_qvalues(value); end
506
+ def parse_range_header(ranges_specifier); end
507
+ def quote(str); end
508
+ def split_header_value(str); end
509
+ def unescape(str); end
510
+ def unescape_form(str); end
511
+
512
+ class << self
513
+ def _escape(str, regex); end
514
+ def _make_regex(str); end
515
+ def _make_regex!(str); end
516
+ def _unescape(str, regex); end
517
+ def dequote(str); end
518
+ def escape(str); end
519
+ def escape8bit(str); end
520
+ def escape_form(str); end
521
+ def escape_path(str); end
522
+ def load_mime_types(file); end
523
+ def mime_type(filename, mime_tab); end
524
+ def normalize_path(path); end
525
+ def parse_form_data(io, boundary); end
526
+ def parse_header(raw); end
527
+ def parse_query(str); end
528
+ def parse_qvalues(value); end
529
+ def parse_range_header(ranges_specifier); end
530
+ def quote(str); end
531
+ def split_header_value(str); end
532
+ def unescape(str); end
533
+ def unescape_form(str); end
534
+ end
535
+ end
536
+
537
+ class WEBrick::HTTPUtils::FormData < ::String
538
+ def initialize(*args); end
539
+
540
+ def <<(str); end
541
+ def [](*key); end
542
+ def append_data(data); end
543
+ def each_data; end
544
+ def filename; end
545
+ def filename=(_arg0); end
546
+ def list; end
547
+ def name; end
548
+ def name=(_arg0); end
549
+ def next_data=(_arg0); end
550
+ def to_ary; end
551
+ def to_s; end
552
+
553
+ protected
554
+
555
+ def next_data; end
556
+ end
557
+
558
+ module WEBrick::Utils
559
+ private
560
+
561
+ def create_listeners(address, port); end
562
+ def getservername; end
563
+ def random_string(len); end
564
+ def set_close_on_exec(io); end
565
+ def set_non_blocking(io); end
566
+ def su(user); end
567
+ def timeout(seconds, exception = T.unsafe(nil)); end
568
+
569
+ class << self
570
+ def create_listeners(address, port); end
571
+ def getservername; end
572
+ def random_string(len); end
573
+ def set_close_on_exec(io); end
574
+ def set_non_blocking(io); end
575
+ def su(user); end
576
+ def timeout(seconds, exception = T.unsafe(nil)); end
577
+ end
578
+ end
579
+
580
+ class WEBrick::Utils::TimeoutHandler
581
+ include ::Singleton
582
+ extend ::Singleton::SingletonClassMethods
583
+
584
+ def initialize; end
585
+
586
+ def cancel(thread, id); end
587
+ def interrupt(thread, id, exception); end
588
+ def register(thread, time, exception); end
589
+ def terminate; end
590
+
591
+ private
592
+
593
+ def watch; end
594
+ def watcher; end
595
+
596
+ class << self
597
+ def cancel(id); end
598
+ def register(seconds, exception); end
599
+ def terminate; end
600
+ end
601
+ end