rails_type_id 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.
Files changed (124) hide show
  1. checksums.yaml +7 -0
  2. data/.rubocop.yml +25 -0
  3. data/.ruby-version +1 -0
  4. data/README.md +46 -0
  5. data/Rakefile +16 -0
  6. data/lib/rails_type_id/concern.rb +129 -0
  7. data/lib/rails_type_id/require.rb +6 -0
  8. data/lib/rails_type_id/test_helper.rb +16 -0
  9. data/lib/rails_type_id/version.rb +6 -0
  10. data/lib/rails_type_id.rb +9 -0
  11. data/lib/tapioca/dsl/compilers/rails_type_id_compiler.rb +49 -0
  12. data/sig/rails_type_id.rbs +4 -0
  13. data/sorbet/config +4 -0
  14. data/sorbet/rbi/annotations/.gitattributes +1 -0
  15. data/sorbet/rbi/annotations/actionmailer.rbi +10 -0
  16. data/sorbet/rbi/annotations/actionpack.rbi +430 -0
  17. data/sorbet/rbi/annotations/actionview.rbi +75 -0
  18. data/sorbet/rbi/annotations/activejob.rbi +44 -0
  19. data/sorbet/rbi/annotations/activemodel.rbi +89 -0
  20. data/sorbet/rbi/annotations/activerecord.rbi +98 -0
  21. data/sorbet/rbi/annotations/activesupport.rbi +468 -0
  22. data/sorbet/rbi/annotations/globalid.rbi +30 -0
  23. data/sorbet/rbi/annotations/minitest.rbi +119 -0
  24. data/sorbet/rbi/annotations/railties.rbi +61 -0
  25. data/sorbet/rbi/annotations/rainbow.rbi +269 -0
  26. data/sorbet/rbi/dsl/.gitattributes +1 -0
  27. data/sorbet/rbi/dsl/active_model/validations/callbacks.rbi +21 -0
  28. data/sorbet/rbi/dsl/active_model/validations.rbi +26 -0
  29. data/sorbet/rbi/dsl/active_support/callbacks.rbi +21 -0
  30. data/sorbet/rbi/dsl/rails_type_id/concern.rbi +22 -0
  31. data/sorbet/rbi/gems/.gitattributes +1 -0
  32. data/sorbet/rbi/gems/actioncable@8.0.2.rbi +3133 -0
  33. data/sorbet/rbi/gems/actionmailbox@8.0.2.rbi +991 -0
  34. data/sorbet/rbi/gems/actionmailer@8.0.2.rbi +2775 -0
  35. data/sorbet/rbi/gems/actionpack@8.0.2.rbi +21167 -0
  36. data/sorbet/rbi/gems/actiontext@8.0.2.rbi +1449 -0
  37. data/sorbet/rbi/gems/actionview@8.0.2.rbi +15789 -0
  38. data/sorbet/rbi/gems/activejob@8.0.2.rbi +2864 -0
  39. data/sorbet/rbi/gems/activemodel@8.0.2.rbi +6946 -0
  40. data/sorbet/rbi/gems/activerecord@8.0.2.rbi +42458 -0
  41. data/sorbet/rbi/gems/activestorage@8.0.2.rbi +2156 -0
  42. data/sorbet/rbi/gems/activesupport@8.0.2.rbi +21274 -0
  43. data/sorbet/rbi/gems/ast@2.4.3.rbi +586 -0
  44. data/sorbet/rbi/gems/base64@0.3.0.rbi +545 -0
  45. data/sorbet/rbi/gems/benchmark@0.4.1.rbi +619 -0
  46. data/sorbet/rbi/gems/bigdecimal@3.2.2.rbi +275 -0
  47. data/sorbet/rbi/gems/builder@3.3.0.rbi +9 -0
  48. data/sorbet/rbi/gems/concurrent-ruby@1.3.5.rbi +11734 -0
  49. data/sorbet/rbi/gems/connection_pool@2.5.3.rbi +9 -0
  50. data/sorbet/rbi/gems/crass@1.0.6.rbi +623 -0
  51. data/sorbet/rbi/gems/date@3.4.1.rbi +403 -0
  52. data/sorbet/rbi/gems/drb@2.2.3.rbi +1661 -0
  53. data/sorbet/rbi/gems/erb@5.0.2.rbi +878 -0
  54. data/sorbet/rbi/gems/erubi@1.13.1.rbi +157 -0
  55. data/sorbet/rbi/gems/globalid@1.2.1.rbi +742 -0
  56. data/sorbet/rbi/gems/i18n@1.14.7.rbi +2383 -0
  57. data/sorbet/rbi/gems/io-console@0.8.1.rbi +9 -0
  58. data/sorbet/rbi/gems/json@2.12.2.rbi +2287 -0
  59. data/sorbet/rbi/gems/language_server-protocol@3.17.0.5.rbi +9 -0
  60. data/sorbet/rbi/gems/lint_roller@1.1.0.rbi +323 -0
  61. data/sorbet/rbi/gems/logger@1.7.0.rbi +963 -0
  62. data/sorbet/rbi/gems/loofah@2.24.1.rbi +1105 -0
  63. data/sorbet/rbi/gems/mail@2.8.1.rbi +8890 -0
  64. data/sorbet/rbi/gems/marcel@1.0.4.rbi +239 -0
  65. data/sorbet/rbi/gems/mini_mime@1.1.5.rbi +173 -0
  66. data/sorbet/rbi/gems/minitest@5.25.5.rbi +2231 -0
  67. data/sorbet/rbi/gems/net-imap@0.5.9.rbi +10285 -0
  68. data/sorbet/rbi/gems/net-pop@0.1.2.rbi +927 -0
  69. data/sorbet/rbi/gems/net-protocol@0.2.2.rbi +292 -0
  70. data/sorbet/rbi/gems/net-smtp@0.5.1.rbi +1240 -0
  71. data/sorbet/rbi/gems/netrc@0.11.0.rbi +177 -0
  72. data/sorbet/rbi/gems/nio4r@2.7.4.rbi +388 -0
  73. data/sorbet/rbi/gems/nokogiri@1.18.9.rbi +8548 -0
  74. data/sorbet/rbi/gems/parallel@1.27.0.rbi +291 -0
  75. data/sorbet/rbi/gems/parser@3.3.9.0.rbi +5537 -0
  76. data/sorbet/rbi/gems/pp@0.6.2.rbi +368 -0
  77. data/sorbet/rbi/gems/prettyprint@0.2.0.rbi +477 -0
  78. data/sorbet/rbi/gems/prism@1.4.0.rbi +41790 -0
  79. data/sorbet/rbi/gems/psych@5.2.6.rbi +2542 -0
  80. data/sorbet/rbi/gems/racc@1.8.1.rbi +168 -0
  81. data/sorbet/rbi/gems/rack-session@2.1.1.rbi +722 -0
  82. data/sorbet/rbi/gems/rack-test@2.2.0.rbi +729 -0
  83. data/sorbet/rbi/gems/rack@3.2.0.rbi +5054 -0
  84. data/sorbet/rbi/gems/rackup@2.2.1.rbi +230 -0
  85. data/sorbet/rbi/gems/rails-dom-testing@2.3.0.rbi +790 -0
  86. data/sorbet/rbi/gems/rails-html-sanitizer@1.6.2.rbi +645 -0
  87. data/sorbet/rbi/gems/rails@8.0.2.rbi +9 -0
  88. data/sorbet/rbi/gems/railties@8.0.2.rbi +4014 -0
  89. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +403 -0
  90. data/sorbet/rbi/gems/rake@13.3.0.rbi +3039 -0
  91. data/sorbet/rbi/gems/rbi@0.3.6.rbi +5162 -0
  92. data/sorbet/rbi/gems/rbs@4.0.0.dev.4.rbi +7895 -0
  93. data/sorbet/rbi/gems/rdoc@6.14.2.rbi +12944 -0
  94. data/sorbet/rbi/gems/regexp_parser@2.10.0.rbi +3833 -0
  95. data/sorbet/rbi/gems/reline@0.6.2.rbi +9 -0
  96. data/sorbet/rbi/gems/require-hooks@0.2.2.rbi +110 -0
  97. data/sorbet/rbi/gems/rexml@3.4.1.rbi +5205 -0
  98. data/sorbet/rbi/gems/rubocop-ast@1.46.0.rbi +7473 -0
  99. data/sorbet/rbi/gems/rubocop-sorbet@0.10.5.rbi +2386 -0
  100. data/sorbet/rbi/gems/rubocop@1.79.1.rbi +63674 -0
  101. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +1318 -0
  102. data/sorbet/rbi/gems/securerandom@0.4.1.rbi +75 -0
  103. data/sorbet/rbi/gems/spoom@1.7.5.rbi +5832 -0
  104. data/sorbet/rbi/gems/sqlite3@2.7.3.rbi +1989 -0
  105. data/sorbet/rbi/gems/stringio@3.1.7.rbi +9 -0
  106. data/sorbet/rbi/gems/tapioca@0.17.7.rbi +3692 -0
  107. data/sorbet/rbi/gems/thor@1.4.0.rbi +4399 -0
  108. data/sorbet/rbi/gems/timeout@0.4.3.rbi +157 -0
  109. data/sorbet/rbi/gems/typeid@0.2.2.rbi +239 -0
  110. data/sorbet/rbi/gems/tzinfo@2.0.6.rbi +5919 -0
  111. data/sorbet/rbi/gems/unicode-display_width@3.1.4.rbi +132 -0
  112. data/sorbet/rbi/gems/unicode-emoji@4.0.4.rbi +251 -0
  113. data/sorbet/rbi/gems/uri@1.0.3.rbi +2354 -0
  114. data/sorbet/rbi/gems/useragent@0.16.11.rbi +9 -0
  115. data/sorbet/rbi/gems/uuid7@0.2.0.rbi +60 -0
  116. data/sorbet/rbi/gems/websocket-driver@0.8.0.rbi +1065 -0
  117. data/sorbet/rbi/gems/websocket-extensions@0.1.5.rbi +117 -0
  118. data/sorbet/rbi/gems/with_model@2.2.0.rbi +282 -0
  119. data/sorbet/rbi/gems/yard-sorbet@0.9.0.rbi +430 -0
  120. data/sorbet/rbi/gems/yard@0.9.37.rbi +18512 -0
  121. data/sorbet/rbi/gems/zeitwerk@2.7.3.rbi +1196 -0
  122. data/sorbet/tapioca/config.yml +13 -0
  123. data/sorbet/tapioca/require.rb +13 -0
  124. metadata +208 -0
@@ -0,0 +1,157 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `timeout` gem.
5
+ # Please instead update this file by running `bin/tapioca gem timeout`.
6
+
7
+
8
+ # source://timeout//lib/timeout.rb#21
9
+ module Timeout
10
+ private
11
+
12
+ # Perform an operation in a block, raising an error if it takes longer than
13
+ # +sec+ seconds to complete.
14
+ #
15
+ # +sec+:: Number of seconds to wait for the block to terminate. Any non-negative number
16
+ # or nil may be used, including Floats to specify fractional seconds. A
17
+ # value of 0 or +nil+ will execute the block without any timeout.
18
+ # Any negative number will raise an ArgumentError.
19
+ # +klass+:: Exception Class to raise if the block fails to terminate
20
+ # in +sec+ seconds. Omitting will use the default, Timeout::Error
21
+ # +message+:: Error message to raise with Exception Class.
22
+ # Omitting will use the default, "execution expired"
23
+ #
24
+ # Returns the result of the block *if* the block completed before
25
+ # +sec+ seconds, otherwise throws an exception, based on the value of +klass+.
26
+ #
27
+ # The exception thrown to terminate the given block cannot be rescued inside
28
+ # the block unless +klass+ is given explicitly. However, the block can use
29
+ # ensure to prevent the handling of the exception. For that reason, this
30
+ # method cannot be relied on to enforce timeouts for untrusted blocks.
31
+ #
32
+ # If a scheduler is defined, it will be used to handle the timeout by invoking
33
+ # Scheduler#timeout_after.
34
+ #
35
+ # Note that this is both a method of module Timeout, so you can <tt>include
36
+ # Timeout</tt> into your classes so they have a #timeout method, as well as
37
+ # a module method, so you can call it directly as Timeout.timeout().
38
+ #
39
+ # @raise [ArgumentError]
40
+ #
41
+ # source://timeout//lib/timeout.rb#167
42
+ def timeout(sec, klass = T.unsafe(nil), message = T.unsafe(nil), &block); end
43
+
44
+ class << self
45
+ # source://timeout//lib/timeout.rb#124
46
+ def ensure_timeout_thread_created; end
47
+
48
+ # Perform an operation in a block, raising an error if it takes longer than
49
+ # +sec+ seconds to complete.
50
+ #
51
+ # +sec+:: Number of seconds to wait for the block to terminate. Any non-negative number
52
+ # or nil may be used, including Floats to specify fractional seconds. A
53
+ # value of 0 or +nil+ will execute the block without any timeout.
54
+ # Any negative number will raise an ArgumentError.
55
+ # +klass+:: Exception Class to raise if the block fails to terminate
56
+ # in +sec+ seconds. Omitting will use the default, Timeout::Error
57
+ # +message+:: Error message to raise with Exception Class.
58
+ # Omitting will use the default, "execution expired"
59
+ #
60
+ # Returns the result of the block *if* the block completed before
61
+ # +sec+ seconds, otherwise throws an exception, based on the value of +klass+.
62
+ #
63
+ # The exception thrown to terminate the given block cannot be rescued inside
64
+ # the block unless +klass+ is given explicitly. However, the block can use
65
+ # ensure to prevent the handling of the exception. For that reason, this
66
+ # method cannot be relied on to enforce timeouts for untrusted blocks.
67
+ #
68
+ # If a scheduler is defined, it will be used to handle the timeout by invoking
69
+ # Scheduler#timeout_after.
70
+ #
71
+ # Note that this is both a method of module Timeout, so you can <tt>include
72
+ # Timeout</tt> into your classes so they have a #timeout method, as well as
73
+ # a module method, so you can call it directly as Timeout.timeout().
74
+ #
75
+ # @raise [ArgumentError]
76
+ #
77
+ # source://timeout//lib/timeout.rb#197
78
+ def timeout(sec, klass = T.unsafe(nil), message = T.unsafe(nil), &block); end
79
+
80
+ private
81
+
82
+ # source://timeout//lib/timeout.rb#94
83
+ def create_timeout_thread; end
84
+ end
85
+ end
86
+
87
+ # :stopdoc:
88
+ #
89
+ # source://timeout//lib/timeout.rb#47
90
+ Timeout::CONDVAR = T.let(T.unsafe(nil), Thread::ConditionVariable)
91
+
92
+ # Raised by Timeout.timeout when the block times out.
93
+ #
94
+ # source://timeout//lib/timeout.rb#33
95
+ class Timeout::Error < ::RuntimeError
96
+ class << self
97
+ # source://timeout//lib/timeout.rb#34
98
+ def handle_timeout(message); end
99
+ end
100
+ end
101
+
102
+ # Internal error raised to when a timeout is triggered.
103
+ #
104
+ # source://timeout//lib/timeout.rb#26
105
+ class Timeout::ExitException < ::Exception
106
+ # source://timeout//lib/timeout.rb#27
107
+ def exception(*_arg0); end
108
+ end
109
+
110
+ # We keep a private reference so that time mocking libraries won't break
111
+ # Timeout.
112
+ #
113
+ # source://timeout//lib/timeout.rb#136
114
+ Timeout::GET_TIME = T.let(T.unsafe(nil), Method)
115
+
116
+ # source://timeout//lib/timeout.rb#48
117
+ Timeout::QUEUE = T.let(T.unsafe(nil), Thread::Queue)
118
+
119
+ # source://timeout//lib/timeout.rb#49
120
+ Timeout::QUEUE_MUTEX = T.let(T.unsafe(nil), Thread::Mutex)
121
+
122
+ # source://timeout//lib/timeout.rb#54
123
+ class Timeout::Request
124
+ # @return [Request] a new instance of Request
125
+ #
126
+ # source://timeout//lib/timeout.rb#57
127
+ def initialize(thread, timeout, exception_class, message); end
128
+
129
+ # Returns the value of attribute deadline.
130
+ #
131
+ # source://timeout//lib/timeout.rb#55
132
+ def deadline; end
133
+
134
+ # @return [Boolean]
135
+ #
136
+ # source://timeout//lib/timeout.rb#67
137
+ def done?; end
138
+
139
+ # @return [Boolean]
140
+ #
141
+ # source://timeout//lib/timeout.rb#73
142
+ def expired?(now); end
143
+
144
+ # source://timeout//lib/timeout.rb#86
145
+ def finished; end
146
+
147
+ # source://timeout//lib/timeout.rb#77
148
+ def interrupt; end
149
+ end
150
+
151
+ # source://timeout//lib/timeout.rb#50
152
+ Timeout::TIMEOUT_THREAD_MUTEX = T.let(T.unsafe(nil), Thread::Mutex)
153
+
154
+ # The version
155
+ #
156
+ # source://timeout//lib/timeout.rb#23
157
+ Timeout::VERSION = T.let(T.unsafe(nil), String)
@@ -0,0 +1,239 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `typeid` gem.
5
+ # Please instead update this file by running `bin/tapioca gem typeid`.
6
+
7
+
8
+ # Represents a TypeID.
9
+ # Provides accessors to the underlying prefix, suffix, and UUID.
10
+ # Can be treated as a string.
11
+ #
12
+ # To generate a new +TypeID+:
13
+ # TypeID.new("foo") #=> #<TypeID foo_01h4vjdvzefw18zfwz5dxw5y8g>
14
+ #
15
+ # To parse a +TypeID+ from a string:
16
+ # TypeID.from_string("foo_01h4vjdvzefw18zfwz5dxw5y8g") #=> #<TypeID foo_01h4vjdvzefw18zfwz5dxw5y8g>
17
+ #
18
+ # To parse a +TypeID+ from a UUID:
19
+ # TypeID.from_uuid("foo", "01893726-efee-7f02-8fbf-9f2b7bc2f910") #=> #<TypeID foo_01h4vjdvzefw18zfwz5dxw5y8g>
20
+ #
21
+ # To create a +TypeID+ from a timestamp (in milliseconds since the Unix epoch):
22
+ # TypeID.new("foo", timestamp: 1688847445998) #=> #<TypeID foo_01h4vjdvzefw18zfwz5dxw5y8g>
23
+ #
24
+ # source://typeid//lib/typeid/uuid/base32.rb#1
25
+ class TypeID < ::String
26
+ # Creates a +TypeID+ given a prefix and an optional suffix or timestamp (in milliseconds since the Unix epoch).
27
+ # When given only a prefix, generates a new +TypeID+.
28
+ # When +suffix+ or +timestamp+ is provided, creates a +TypeID+ from the given value.
29
+ #
30
+ # @param prefix [String]
31
+ # @param timestamp [Integer] milliseconds since the Unix epoch
32
+ # @param suffix [String] base32-encoded UUID
33
+ # @raise [Error]
34
+ # @return [TypeID] a new instance of TypeID
35
+ #
36
+ # source://typeid//lib/typeid.rb#80
37
+ def initialize(prefix, timestamp: T.unsafe(nil), suffix: T.unsafe(nil)); end
38
+
39
+ # @return [String]
40
+ #
41
+ # source://typeid//lib/typeid.rb#106
42
+ def inspect; end
43
+
44
+ # @return [String]
45
+ #
46
+ # source://typeid//lib/typeid.rb#24
47
+ def prefix; end
48
+
49
+ # @return [String]
50
+ #
51
+ # source://typeid//lib/typeid.rb#27
52
+ def suffix; end
53
+
54
+ # @return [String]
55
+ #
56
+ # source://typeid//lib/typeid.rb#28
57
+ def type; end
58
+
59
+ # Returns the UUID component of the +TypeID+, parsed from the suffix.
60
+ #
61
+ # @return [TypeID::UUID]
62
+ #
63
+ # source://typeid//lib/typeid.rb#101
64
+ def uuid; end
65
+
66
+ private
67
+
68
+ # @return [String]
69
+ #
70
+ # source://typeid//lib/typeid.rb#113
71
+ def string; end
72
+
73
+ class << self
74
+ # Creates a +TypeID+ given a prefix string and a suffix string.
75
+ #
76
+ # @param prefix [String]
77
+ # @param suffix [String]
78
+ # @return [TypeID]
79
+ #
80
+ # source://typeid//lib/typeid.rb#62
81
+ def from(prefix, suffix); end
82
+
83
+ # Parses a +TypeID+ from a string.
84
+ #
85
+ # @param string [String] string representation of a +TypeID+
86
+ # @return [TypeID]
87
+ #
88
+ # source://typeid//lib/typeid.rb#34
89
+ def from_string(string); end
90
+
91
+ # Parses a +TypeID+ given a prefix and a raw UUID string.
92
+ #
93
+ # @param prefix [String]
94
+ # @param uuid [String]
95
+ # @return [TypeID]
96
+ #
97
+ # source://typeid//lib/typeid.rb#53
98
+ def from_uuid(prefix, uuid); end
99
+
100
+ # Returns the +nil+ TypeID.
101
+ #
102
+ # @return [TypeID]
103
+ #
104
+ # source://typeid//lib/typeid.rb#69
105
+ def nil; end
106
+ end
107
+ end
108
+
109
+ # source://typeid//lib/typeid.rb#21
110
+ class TypeID::Error < ::StandardError; end
111
+
112
+ # source://typeid//lib/typeid.rb#19
113
+ TypeID::MAX_PREFIX_LENGTH = T.let(T.unsafe(nil), Integer)
114
+
115
+ # Represents a UUID. Can be treated as a string.
116
+ #
117
+ # source://typeid//lib/typeid/uuid/base32.rb#2
118
+ class TypeID::UUID < ::String
119
+ # Initializes a +UUID+ from an array of bytes.
120
+ #
121
+ # @param bytes [Array<Integer>] size 16 byte array
122
+ # @return [UUID] a new instance of UUID
123
+ #
124
+ # source://typeid//lib/typeid/uuid.rb#50
125
+ def initialize(bytes); end
126
+
127
+ # Returns the +UUID+ encoded as a base32 +String+.
128
+ #
129
+ # @return [String]
130
+ #
131
+ # source://typeid//lib/typeid/uuid.rb#59
132
+ def base32; end
133
+
134
+ # @return [Array<Integer>]
135
+ #
136
+ # source://typeid//lib/typeid/uuid.rb#8
137
+ def bytes; end
138
+
139
+ # @return [String]
140
+ #
141
+ # source://typeid//lib/typeid/uuid.rb#73
142
+ def inspect; end
143
+
144
+ # Returns the timestamp of the +UUID+ as milliseconds since the Unix epoch.
145
+ #
146
+ # @return [Integer]
147
+ #
148
+ # source://typeid//lib/typeid/uuid.rb#66
149
+ def timestamp; end
150
+
151
+ private
152
+
153
+ # @return [String]
154
+ #
155
+ # source://typeid//lib/typeid/uuid.rb#80
156
+ def string; end
157
+
158
+ class << self
159
+ # Parses a +UUID+ from a base32 +String+.
160
+ #
161
+ # @param string [String] base32-encoded UUID
162
+ # @return [TypeID::UUID]
163
+ #
164
+ # source://typeid//lib/typeid/uuid.rb#29
165
+ def from_base32(string); end
166
+
167
+ # Parses a +UUID+ from a raw +String+.
168
+ #
169
+ # @param string [String] raw UUID
170
+ # @return [TypeID::UUID]
171
+ #
172
+ # source://typeid//lib/typeid/uuid.rb#37
173
+ def from_string(string); end
174
+
175
+ # Generates a new +UUID+, using gem "uuid7".
176
+ #
177
+ # @param timestamp [Integer] milliseconds since the Unix epoch
178
+ # @return [TypeID::UUID]
179
+ #
180
+ # source://typeid//lib/typeid/uuid.rb#21
181
+ def generate(timestamp: T.unsafe(nil)); end
182
+
183
+ # Utility method to generate a timestamp as milliseconds since the Unix epoch.
184
+ #
185
+ # @return [Integer]
186
+ #
187
+ # source://typeid//lib/typeid/uuid.rb#13
188
+ def timestamp; end
189
+ end
190
+ end
191
+
192
+ # Provides utilities for encoding and decoding UUIDs to and from base32.
193
+ # Based on https://github.com/jetpack-io/typeid-go/blob/341e2b135e0609db272e6400f2f551487725824a/base32/base32.go.
194
+ #
195
+ # source://typeid//lib/typeid/uuid/base32.rb#6
196
+ module TypeID::UUID::Base32
197
+ class << self
198
+ # Decodes a size 26 +String+ into a size 16 byte +Array+.
199
+ # Based on https://github.com/jetpack-io/typeid-go/blob/341e2b135e0609db272e6400f2f551487725824a/base32/base32.go#L82.
200
+ # Each line needs an extra `& 0xFF` because the elements are +Integer+s, which don't truncate on left shifts.
201
+ #
202
+ # @param string [String] size 26 base32-encoded string
203
+ # @raise [Error]
204
+ # @return [Array<Integer>]
205
+ #
206
+ # source://typeid//lib/typeid/uuid/base32.rb#95
207
+ def decode(string); end
208
+
209
+ # Encodes a size 16 byte +Array+ into a size 26 +String+.
210
+ # Based on https://github.com/jetpack-io/typeid-go/blob/341e2b135e0609db272e6400f2f551487725824a/base32/base32.go#L14.
211
+ #
212
+ # @param bytes [Array<Integer>] size 16 byte array
213
+ # @raise [Error]
214
+ # @return [String]
215
+ #
216
+ # source://typeid//lib/typeid/uuid/base32.rb#51
217
+ def encode(bytes); end
218
+ end
219
+ end
220
+
221
+ # Crockford's Base32 alphabet.
222
+ #
223
+ # source://typeid//lib/typeid/uuid/base32.rb#13
224
+ TypeID::UUID::Base32::ALPHABET = T.let(T.unsafe(nil), String)
225
+
226
+ # Byte to index table for O(1) lookups when unmarshaling.
227
+ # We use 0xFF as sentinel value for invalid indexes.
228
+ #
229
+ # source://typeid//lib/typeid/uuid/base32.rb#17
230
+ TypeID::UUID::Base32::DEC = T.let(T.unsafe(nil), Array)
231
+
232
+ # source://typeid//lib/typeid/uuid/base32.rb#7
233
+ TypeID::UUID::Base32::DECODED_BYTE_ARRAY_LENGTH = T.let(T.unsafe(nil), Integer)
234
+
235
+ # source://typeid//lib/typeid/uuid/base32.rb#8
236
+ TypeID::UUID::Base32::ENCODED_STRING_LENGTH = T.let(T.unsafe(nil), Integer)
237
+
238
+ # source://typeid//lib/typeid/uuid/base32.rb#10
239
+ class TypeID::UUID::Base32::Error < ::StandardError; end