rbs 3.1.3 → 3.2.0.pre.1

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 (68) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +0 -6
  3. data/CHANGELOG.md +68 -0
  4. data/Gemfile +0 -6
  5. data/Gemfile.lock +12 -21
  6. data/README.md +1 -1
  7. data/Rakefile +44 -0
  8. data/Steepfile +3 -3
  9. data/core/array.rbs +0 -8
  10. data/core/builtin.rbs +28 -8
  11. data/core/constants.rbs +13 -5
  12. data/core/exception.rbs +1 -1
  13. data/core/global_variables.rbs +27 -27
  14. data/core/io.rbs +163 -172
  15. data/core/kernel.rbs +7 -4
  16. data/core/module.rbs +34 -32
  17. data/core/object.rbs +2 -2
  18. data/core/string_io.rbs +9 -0
  19. data/core/thread.rbs +25 -1
  20. data/core/time.rbs +3 -3
  21. data/docs/CONTRIBUTING.md +1 -1
  22. data/docs/rbs_by_example.md +16 -35
  23. data/docs/repo.md +1 -1
  24. data/docs/sigs.md +7 -7
  25. data/docs/stdlib.md +2 -3
  26. data/docs/syntax.md +40 -40
  27. data/lib/rbs/cli.rb +15 -4
  28. data/lib/rbs/collection/installer.rb +5 -2
  29. data/lib/rbs/collection/sources/stdlib.rb +5 -1
  30. data/lib/rbs/errors.rb +8 -1
  31. data/lib/rbs/file_finder.rb +1 -1
  32. data/lib/rbs/prototype/rb.rb +64 -6
  33. data/lib/rbs/prototype/rbi.rb +2 -6
  34. data/lib/rbs/prototype/runtime.rb +29 -8
  35. data/lib/rbs/subtractor.rb +17 -0
  36. data/lib/rbs/type_name.rb +4 -4
  37. data/lib/rbs/version.rb +1 -1
  38. data/rbs.gemspec +1 -1
  39. data/schema/decls.json +1 -1
  40. data/sig/errors.rbs +54 -0
  41. data/sig/parser.rbs +2 -2
  42. data/sig/prototype/rb.rbs +9 -1
  43. data/sig/subtractor.rbs +4 -0
  44. data/stdlib/logger/0/logger.rbs +1 -1
  45. data/stdlib/observable/0/observable.rbs +219 -0
  46. data/stdlib/uri/0/common.rbs +24 -0
  47. data/stdlib/zlib/0/buf_error.rbs +79 -0
  48. data/stdlib/zlib/0/data_error.rbs +79 -0
  49. data/stdlib/zlib/0/deflate.rbs +276 -0
  50. data/stdlib/zlib/0/error.rbs +89 -0
  51. data/stdlib/zlib/0/gzip_file/crc_error.rbs +115 -0
  52. data/stdlib/zlib/0/gzip_file/error.rbs +128 -0
  53. data/stdlib/zlib/0/gzip_file/length_error.rbs +115 -0
  54. data/stdlib/zlib/0/gzip_file/no_footer.rbs +114 -0
  55. data/stdlib/zlib/0/gzip_file.rbs +228 -0
  56. data/stdlib/zlib/0/gzip_reader.rbs +362 -0
  57. data/stdlib/zlib/0/gzip_writer.rbs +237 -0
  58. data/stdlib/zlib/0/inflate.rbs +249 -0
  59. data/stdlib/zlib/0/mem_error.rbs +79 -0
  60. data/stdlib/zlib/0/need_dict.rbs +82 -0
  61. data/stdlib/zlib/0/stream_end.rbs +80 -0
  62. data/stdlib/zlib/0/stream_error.rbs +80 -0
  63. data/stdlib/zlib/0/version_error.rbs +80 -0
  64. data/stdlib/zlib/0/zstream.rbs +270 -0
  65. metadata +24 -8
  66. data/stdlib/prime/0/integer-extension.rbs +0 -41
  67. data/stdlib/prime/0/manifest.yaml +0 -2
  68. data/stdlib/prime/0/prime.rbs +0 -372
@@ -0,0 +1,270 @@
1
+ # <!-- rdoc-file=ext/zlib/zlib.c -->
2
+ # This module provides access to the [zlib library](http://zlib.net). Zlib is
3
+ # designed to be a portable, free, general-purpose, legally unencumbered -- that
4
+ # is, not covered by any patents -- lossless data-compression library for use on
5
+ # virtually any computer hardware and operating system.
6
+ #
7
+ # The zlib compression library provides in-memory compression and decompression
8
+ # functions, including integrity checks of the uncompressed data.
9
+ #
10
+ # The zlib compressed data format is described in RFC 1950, which is a wrapper
11
+ # around a deflate stream which is described in RFC 1951.
12
+ #
13
+ # The library also supports reading and writing files in gzip (.gz) format with
14
+ # an interface similar to that of IO. The gzip format is described in RFC 1952
15
+ # which is also a wrapper around a deflate stream.
16
+ #
17
+ # The zlib format was designed to be compact and fast for use in memory and on
18
+ # communications channels. The gzip format was designed for single-file
19
+ # compression on file systems, has a larger header than zlib to maintain
20
+ # directory information, and uses a different, slower check method than zlib.
21
+ #
22
+ # See your system's zlib.h for further information about zlib
23
+ #
24
+ # ## Sample usage
25
+ #
26
+ # Using the wrapper to compress strings with default parameters is quite simple:
27
+ #
28
+ # require "zlib"
29
+ #
30
+ # data_to_compress = File.read("don_quixote.txt")
31
+ #
32
+ # puts "Input size: #{data_to_compress.size}"
33
+ # #=> Input size: 2347740
34
+ #
35
+ # data_compressed = Zlib::Deflate.deflate(data_to_compress)
36
+ #
37
+ # puts "Compressed size: #{data_compressed.size}"
38
+ # #=> Compressed size: 887238
39
+ #
40
+ # uncompressed_data = Zlib::Inflate.inflate(data_compressed)
41
+ #
42
+ # puts "Uncompressed data is: #{uncompressed_data}"
43
+ # #=> Uncompressed data is: The Project Gutenberg EBook of Don Quixote...
44
+ #
45
+ # ## Class tree
46
+ #
47
+ # * Zlib::Deflate
48
+ # * Zlib::Inflate
49
+ # * Zlib::ZStream
50
+ # * Zlib::Error
51
+ # * Zlib::StreamEnd
52
+ # * Zlib::NeedDict
53
+ # * Zlib::DataError
54
+ # * Zlib::StreamError
55
+ # * Zlib::MemError
56
+ # * Zlib::BufError
57
+ # * Zlib::VersionError
58
+ # * Zlib::InProgressError
59
+ #
60
+ #
61
+ #
62
+ # (if you have GZIP_SUPPORT)
63
+ # * Zlib::GzipReader
64
+ # * Zlib::GzipWriter
65
+ # * Zlib::GzipFile
66
+ # * Zlib::GzipFile::Error
67
+ # * Zlib::GzipFile::LengthError
68
+ # * Zlib::GzipFile::CRCError
69
+ # * Zlib::GzipFile::NoFooter
70
+ #
71
+ module Zlib
72
+ # <!-- rdoc-file=ext/zlib/zlib.c -->
73
+ # Zlib::ZStream is the abstract class for the stream which handles the
74
+ # compressed data. The operations are defined in the subclasses: Zlib::Deflate
75
+ # for compression, and Zlib::Inflate for decompression.
76
+ #
77
+ # An instance of Zlib::ZStream has one stream (struct zstream in the source) and
78
+ # two variable-length buffers which associated to the input (next_in) of the
79
+ # stream and the output (next_out) of the stream. In this document, "input
80
+ # buffer" means the buffer for input, and "output buffer" means the buffer for
81
+ # output.
82
+ #
83
+ # Data input into an instance of Zlib::ZStream are temporally stored into the
84
+ # end of input buffer, and then data in input buffer are processed from the
85
+ # beginning of the buffer until no more output from the stream is produced (i.e.
86
+ # until avail_out > 0 after processing). During processing, output buffer is
87
+ # allocated and expanded automatically to hold all output data.
88
+ #
89
+ # Some particular instance methods consume the data in output buffer and return
90
+ # them as a String.
91
+ #
92
+ # Here is an ascii art for describing above:
93
+ #
94
+ # +================ an instance of Zlib::ZStream ================+
95
+ # || ||
96
+ # || +--------+ +-------+ +--------+ ||
97
+ # || +--| output |<---------|zstream|<---------| input |<--+ ||
98
+ # || | | buffer | next_out+-------+next_in | buffer | | ||
99
+ # || | +--------+ +--------+ | ||
100
+ # || | | ||
101
+ # +===|======================================================|===+
102
+ # | |
103
+ # v |
104
+ # "output data" "input data"
105
+ #
106
+ # If an error occurs during processing input buffer, an exception which is a
107
+ # subclass of Zlib::Error is raised. At that time, both input and output buffer
108
+ # keep their conditions at the time when the error occurs.
109
+ #
110
+ # ## Method Catalogue
111
+ #
112
+ # Many of the methods in this class are fairly low-level and unlikely to be of
113
+ # interest to users. In fact, users are unlikely to use this class directly;
114
+ # rather they will be interested in Zlib::Inflate and Zlib::Deflate.
115
+ #
116
+ # The higher level methods are listed below.
117
+ #
118
+ # * #total_in
119
+ # * #total_out
120
+ # * #data_type
121
+ # * #adler
122
+ # * #reset
123
+ # * #finish
124
+ # * #finished?
125
+ # * #close
126
+ # * #closed?
127
+ #
128
+ class ZStream
129
+ public
130
+
131
+ # <!--
132
+ # rdoc-file=ext/zlib/zlib.c
133
+ # - adler()
134
+ # -->
135
+ # Returns the adler-32 checksum.
136
+ #
137
+ def adler: () -> Integer
138
+
139
+ # <!--
140
+ # rdoc-file=ext/zlib/zlib.c
141
+ # - avail_in()
142
+ # -->
143
+ # Returns bytes of data in the input buffer. Normally, returns 0.
144
+ #
145
+ def avail_in: () -> Integer
146
+
147
+ # <!--
148
+ # rdoc-file=ext/zlib/zlib.c
149
+ # - avail_out()
150
+ # -->
151
+ # Returns number of bytes of free spaces in output buffer. Because the free
152
+ # space is allocated automatically, this method returns 0 normally.
153
+ #
154
+ def avail_out: () -> Integer
155
+
156
+ # <!--
157
+ # rdoc-file=ext/zlib/zlib.c
158
+ # - avail_out=(p1)
159
+ # -->
160
+ # Allocates `size` bytes of free space in the output buffer. If there are more
161
+ # than `size` bytes already in the buffer, the buffer is truncated. Because free
162
+ # space is allocated automatically, you usually don't need to use this method.
163
+ #
164
+ def avail_out=: (Integer p1) -> void
165
+
166
+ # <!--
167
+ # rdoc-file=ext/zlib/zlib.c
168
+ # - close()
169
+ # -->
170
+ # Closes the stream. All operations on the closed stream will raise an
171
+ # exception.
172
+ #
173
+ def close: () -> void
174
+
175
+ # <!--
176
+ # rdoc-file=ext/zlib/zlib.c
177
+ # - closed?()
178
+ # -->
179
+ # Returns true if the stream is closed.
180
+ #
181
+ def closed?: () -> bool
182
+
183
+ # <!--
184
+ # rdoc-file=ext/zlib/zlib.c
185
+ # - data_type()
186
+ # -->
187
+ # Guesses the type of the data which have been inputed into the stream. The
188
+ # returned value is either `BINARY`, `ASCII`, or `UNKNOWN`.
189
+ #
190
+ def data_type: () -> String
191
+
192
+ # <!-- rdoc-file=ext/zlib/zlib.c -->
193
+ # Closes the stream. All operations on the closed stream will raise an
194
+ # exception.
195
+ #
196
+ def end: () -> void
197
+
198
+ # <!-- rdoc-file=ext/zlib/zlib.c -->
199
+ # Returns true if the stream is closed.
200
+ #
201
+ def ended?: () -> bool
202
+
203
+ # <!--
204
+ # rdoc-file=ext/zlib/zlib.c
205
+ # - finish -> String
206
+ # - finish { |chunk| ... } -> nil
207
+ # -->
208
+ # Finishes the stream and flushes output buffer. If a block is given each chunk
209
+ # is yielded to the block until the input buffer has been flushed to the output
210
+ # buffer.
211
+ #
212
+ def finish: () -> void
213
+
214
+ # <!--
215
+ # rdoc-file=ext/zlib/zlib.c
216
+ # - finished?()
217
+ # -->
218
+ # Returns true if the stream is finished.
219
+ #
220
+ def finished?: () -> bool
221
+
222
+ # <!--
223
+ # rdoc-file=ext/zlib/zlib.c
224
+ # - flush_next_in -> input
225
+ # -->
226
+ #
227
+ def flush_next_in: () -> String
228
+
229
+ # <!--
230
+ # rdoc-file=ext/zlib/zlib.c
231
+ # - flush_next_out -> String
232
+ # - flush_next_out { |chunk| ... } -> nil
233
+ # -->
234
+ # Flushes output buffer and returns all data in that buffer. If a block is
235
+ # given each chunk is yielded to the block until the current output buffer has
236
+ # been flushed.
237
+ #
238
+ def flush_next_out: () -> String?
239
+
240
+ # <!--
241
+ # rdoc-file=ext/zlib/zlib.c
242
+ # - reset()
243
+ # -->
244
+ # Resets and initializes the stream. All data in both input and output buffer
245
+ # are discarded.
246
+ #
247
+ def reset: () -> void
248
+
249
+ # <!-- rdoc-file=ext/zlib/zlib.c -->
250
+ # Returns true if the stream is finished.
251
+ #
252
+ def stream_end?: () -> bool
253
+
254
+ # <!--
255
+ # rdoc-file=ext/zlib/zlib.c
256
+ # - total_in()
257
+ # -->
258
+ # Returns the total bytes of the input data to the stream. FIXME
259
+ #
260
+ def total_in: () -> Integer
261
+
262
+ # <!--
263
+ # rdoc-file=ext/zlib/zlib.c
264
+ # - total_out()
265
+ # -->
266
+ # Returns the total bytes of the output data from the stream. FIXME
267
+ #
268
+ def total_out: () -> Integer
269
+ end
270
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbs
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.3
4
+ version: 3.2.0.pre.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Soutaro Matsumoto
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-07-31 00:00:00.000000000 Z
11
+ date: 2023-08-18 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: RBS is the language for type signatures for Ruby and standard library
14
14
  definitions.
@@ -374,14 +374,12 @@ files:
374
374
  - stdlib/net-http/0/net-http.rbs
375
375
  - stdlib/nkf/0/nkf.rbs
376
376
  - stdlib/objspace/0/objspace.rbs
377
+ - stdlib/observable/0/observable.rbs
377
378
  - stdlib/openssl/0/manifest.yaml
378
379
  - stdlib/openssl/0/openssl.rbs
379
380
  - stdlib/optparse/0/optparse.rbs
380
381
  - stdlib/pathname/0/pathname.rbs
381
382
  - stdlib/prettyprint/0/prettyprint.rbs
382
- - stdlib/prime/0/integer-extension.rbs
383
- - stdlib/prime/0/manifest.yaml
384
- - stdlib/prime/0/prime.rbs
385
383
  - stdlib/pstore/0/pstore.rbs
386
384
  - stdlib/pty/0/pty.rbs
387
385
  - stdlib/rdoc/0/rdoc.rbs
@@ -427,7 +425,25 @@ files:
427
425
  - stdlib/yaml/0/manifest.yaml
428
426
  - stdlib/yaml/0/store.rbs
429
427
  - stdlib/yaml/0/yaml.rbs
428
+ - stdlib/zlib/0/buf_error.rbs
429
+ - stdlib/zlib/0/data_error.rbs
430
+ - stdlib/zlib/0/deflate.rbs
431
+ - stdlib/zlib/0/error.rbs
432
+ - stdlib/zlib/0/gzip_file.rbs
433
+ - stdlib/zlib/0/gzip_file/crc_error.rbs
434
+ - stdlib/zlib/0/gzip_file/error.rbs
435
+ - stdlib/zlib/0/gzip_file/length_error.rbs
436
+ - stdlib/zlib/0/gzip_file/no_footer.rbs
437
+ - stdlib/zlib/0/gzip_reader.rbs
438
+ - stdlib/zlib/0/gzip_writer.rbs
439
+ - stdlib/zlib/0/inflate.rbs
440
+ - stdlib/zlib/0/mem_error.rbs
441
+ - stdlib/zlib/0/need_dict.rbs
442
+ - stdlib/zlib/0/stream_end.rbs
443
+ - stdlib/zlib/0/stream_error.rbs
444
+ - stdlib/zlib/0/version_error.rbs
430
445
  - stdlib/zlib/0/zlib.rbs
446
+ - stdlib/zlib/0/zstream.rbs
431
447
  homepage: https://github.com/ruby/rbs
432
448
  licenses:
433
449
  - BSD-2-Clause
@@ -444,12 +460,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
444
460
  requirements:
445
461
  - - ">="
446
462
  - !ruby/object:Gem::Version
447
- version: '2.6'
463
+ version: '3.0'
448
464
  required_rubygems_version: !ruby/object:Gem::Requirement
449
465
  requirements:
450
- - - ">="
466
+ - - ">"
451
467
  - !ruby/object:Gem::Version
452
- version: '0'
468
+ version: 1.3.1
453
469
  requirements: []
454
470
  rubygems_version: 3.4.10
455
471
  signing_key:
@@ -1,41 +0,0 @@
1
- %a{annotate:rdoc:skip}
2
- class Integer
3
- # <!--
4
- # rdoc-file=lib/prime.rb
5
- # - each_prime(ubound) { |prime| ... }
6
- # -->
7
- # Iterates the given block over all prime numbers.
8
- #
9
- # See `Prime`#each for more details.
10
- #
11
- def self.each_prime: (Integer) { (Integer) -> void } -> void
12
-
13
- # <!--
14
- # rdoc-file=lib/prime.rb
15
- # - from_prime_division(pd)
16
- # -->
17
- # Re-composes a prime factorization and returns the product.
18
- #
19
- # See Prime#int_from_prime_division for more details.
20
- #
21
- def self.from_prime_division: (Array[[ String ]]) -> Integer
22
-
23
- # <!--
24
- # rdoc-file=lib/prime.rb
25
- # - prime_division(generator = Prime::Generator23.new)
26
- # -->
27
- # Returns the factorization of `self`.
28
- #
29
- # See Prime#prime_division for more details.
30
- #
31
- def prime_division: (?Prime::PseudoPrimeGenerator) -> Array[[ Integer, Integer ]]
32
-
33
- # <!--
34
- # rdoc-file=lib/prime.rb
35
- # - prime?()
36
- # -->
37
- # Returns true if `self` is a prime number, else returns false. Not recommended
38
- # for very big integers (> 10**23).
39
- #
40
- def prime?: () -> bool
41
- end
@@ -1,2 +0,0 @@
1
- dependencies:
2
- - name: singleton