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.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +0 -6
- data/CHANGELOG.md +68 -0
- data/Gemfile +0 -6
- data/Gemfile.lock +12 -21
- data/README.md +1 -1
- data/Rakefile +44 -0
- data/Steepfile +3 -3
- data/core/array.rbs +0 -8
- data/core/builtin.rbs +28 -8
- data/core/constants.rbs +13 -5
- data/core/exception.rbs +1 -1
- data/core/global_variables.rbs +27 -27
- data/core/io.rbs +163 -172
- data/core/kernel.rbs +7 -4
- data/core/module.rbs +34 -32
- data/core/object.rbs +2 -2
- data/core/string_io.rbs +9 -0
- data/core/thread.rbs +25 -1
- data/core/time.rbs +3 -3
- data/docs/CONTRIBUTING.md +1 -1
- data/docs/rbs_by_example.md +16 -35
- data/docs/repo.md +1 -1
- data/docs/sigs.md +7 -7
- data/docs/stdlib.md +2 -3
- data/docs/syntax.md +40 -40
- data/lib/rbs/cli.rb +15 -4
- data/lib/rbs/collection/installer.rb +5 -2
- data/lib/rbs/collection/sources/stdlib.rb +5 -1
- data/lib/rbs/errors.rb +8 -1
- data/lib/rbs/file_finder.rb +1 -1
- data/lib/rbs/prototype/rb.rb +64 -6
- data/lib/rbs/prototype/rbi.rb +2 -6
- data/lib/rbs/prototype/runtime.rb +29 -8
- data/lib/rbs/subtractor.rb +17 -0
- data/lib/rbs/type_name.rb +4 -4
- data/lib/rbs/version.rb +1 -1
- data/rbs.gemspec +1 -1
- data/schema/decls.json +1 -1
- data/sig/errors.rbs +54 -0
- data/sig/parser.rbs +2 -2
- data/sig/prototype/rb.rbs +9 -1
- data/sig/subtractor.rbs +4 -0
- data/stdlib/logger/0/logger.rbs +1 -1
- data/stdlib/observable/0/observable.rbs +219 -0
- data/stdlib/uri/0/common.rbs +24 -0
- data/stdlib/zlib/0/buf_error.rbs +79 -0
- data/stdlib/zlib/0/data_error.rbs +79 -0
- data/stdlib/zlib/0/deflate.rbs +276 -0
- data/stdlib/zlib/0/error.rbs +89 -0
- data/stdlib/zlib/0/gzip_file/crc_error.rbs +115 -0
- data/stdlib/zlib/0/gzip_file/error.rbs +128 -0
- data/stdlib/zlib/0/gzip_file/length_error.rbs +115 -0
- data/stdlib/zlib/0/gzip_file/no_footer.rbs +114 -0
- data/stdlib/zlib/0/gzip_file.rbs +228 -0
- data/stdlib/zlib/0/gzip_reader.rbs +362 -0
- data/stdlib/zlib/0/gzip_writer.rbs +237 -0
- data/stdlib/zlib/0/inflate.rbs +249 -0
- data/stdlib/zlib/0/mem_error.rbs +79 -0
- data/stdlib/zlib/0/need_dict.rbs +82 -0
- data/stdlib/zlib/0/stream_end.rbs +80 -0
- data/stdlib/zlib/0/stream_error.rbs +80 -0
- data/stdlib/zlib/0/version_error.rbs +80 -0
- data/stdlib/zlib/0/zstream.rbs +270 -0
- metadata +24 -8
- data/stdlib/prime/0/integer-extension.rbs +0 -41
- data/stdlib/prime/0/manifest.yaml +0 -2
- data/stdlib/prime/0/prime.rbs +0 -372
@@ -0,0 +1,128 @@
|
|
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::GzipFile is an abstract class for handling a gzip formatted compressed
|
74
|
+
# file. The operations are defined in the subclasses, Zlib::GzipReader for
|
75
|
+
# reading, and Zlib::GzipWriter for writing.
|
76
|
+
#
|
77
|
+
# GzipReader should be used by associating an IO, or IO-like, object.
|
78
|
+
#
|
79
|
+
# ## Method Catalogue
|
80
|
+
#
|
81
|
+
# * ::wrap
|
82
|
+
# * ::open (Zlib::GzipReader::open and Zlib::GzipWriter::open)
|
83
|
+
# * #close
|
84
|
+
# * #closed?
|
85
|
+
# * #comment
|
86
|
+
# * comment= (Zlib::GzipWriter#comment=)
|
87
|
+
# * #crc
|
88
|
+
# * eof? (Zlib::GzipReader#eof?)
|
89
|
+
# * #finish
|
90
|
+
# * #level
|
91
|
+
# * lineno (Zlib::GzipReader#lineno)
|
92
|
+
# * lineno= (Zlib::GzipReader#lineno=)
|
93
|
+
# * #mtime
|
94
|
+
# * mtime= (Zlib::GzipWriter#mtime=)
|
95
|
+
# * #orig_name
|
96
|
+
# * orig_name (Zlib::GzipWriter#orig_name=)
|
97
|
+
# * #os_code
|
98
|
+
# * path (when the underlying IO supports #path)
|
99
|
+
# * #sync
|
100
|
+
# * #sync=
|
101
|
+
# * #to_io
|
102
|
+
#
|
103
|
+
#
|
104
|
+
# (due to internal structure, documentation may appear under Zlib::GzipReader or
|
105
|
+
# Zlib::GzipWriter)
|
106
|
+
#
|
107
|
+
class GzipFile
|
108
|
+
# <!-- rdoc-file=ext/zlib/zlib.c -->
|
109
|
+
# Base class of errors that occur when processing GZIP files.
|
110
|
+
#
|
111
|
+
class Error < Zlib::Error
|
112
|
+
public
|
113
|
+
|
114
|
+
# <!-- rdoc-file=ext/zlib/zlib.c -->
|
115
|
+
# input gzipped string
|
116
|
+
#
|
117
|
+
def input: () -> String
|
118
|
+
|
119
|
+
# <!--
|
120
|
+
# rdoc-file=ext/zlib/zlib.c
|
121
|
+
# - inspect()
|
122
|
+
# -->
|
123
|
+
# Constructs a String of the GzipFile Error
|
124
|
+
#
|
125
|
+
def inspect: () -> String
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
@@ -0,0 +1,115 @@
|
|
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::GzipFile is an abstract class for handling a gzip formatted compressed
|
74
|
+
# file. The operations are defined in the subclasses, Zlib::GzipReader for
|
75
|
+
# reading, and Zlib::GzipWriter for writing.
|
76
|
+
#
|
77
|
+
# GzipReader should be used by associating an IO, or IO-like, object.
|
78
|
+
#
|
79
|
+
# ## Method Catalogue
|
80
|
+
#
|
81
|
+
# * ::wrap
|
82
|
+
# * ::open (Zlib::GzipReader::open and Zlib::GzipWriter::open)
|
83
|
+
# * #close
|
84
|
+
# * #closed?
|
85
|
+
# * #comment
|
86
|
+
# * comment= (Zlib::GzipWriter#comment=)
|
87
|
+
# * #crc
|
88
|
+
# * eof? (Zlib::GzipReader#eof?)
|
89
|
+
# * #finish
|
90
|
+
# * #level
|
91
|
+
# * lineno (Zlib::GzipReader#lineno)
|
92
|
+
# * lineno= (Zlib::GzipReader#lineno=)
|
93
|
+
# * #mtime
|
94
|
+
# * mtime= (Zlib::GzipWriter#mtime=)
|
95
|
+
# * #orig_name
|
96
|
+
# * orig_name (Zlib::GzipWriter#orig_name=)
|
97
|
+
# * #os_code
|
98
|
+
# * path (when the underlying IO supports #path)
|
99
|
+
# * #sync
|
100
|
+
# * #sync=
|
101
|
+
# * #to_io
|
102
|
+
#
|
103
|
+
#
|
104
|
+
# (due to internal structure, documentation may appear under Zlib::GzipReader or
|
105
|
+
# Zlib::GzipWriter)
|
106
|
+
#
|
107
|
+
class GzipFile
|
108
|
+
# <!-- rdoc-file=ext/zlib/zlib.c -->
|
109
|
+
# Raised when the data length recorded in the gzip file footer is not equivalent
|
110
|
+
# to the length of the actual uncompressed data.
|
111
|
+
#
|
112
|
+
class LengthError < Zlib::GzipFile::Error
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
@@ -0,0 +1,114 @@
|
|
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::GzipFile is an abstract class for handling a gzip formatted compressed
|
74
|
+
# file. The operations are defined in the subclasses, Zlib::GzipReader for
|
75
|
+
# reading, and Zlib::GzipWriter for writing.
|
76
|
+
#
|
77
|
+
# GzipReader should be used by associating an IO, or IO-like, object.
|
78
|
+
#
|
79
|
+
# ## Method Catalogue
|
80
|
+
#
|
81
|
+
# * ::wrap
|
82
|
+
# * ::open (Zlib::GzipReader::open and Zlib::GzipWriter::open)
|
83
|
+
# * #close
|
84
|
+
# * #closed?
|
85
|
+
# * #comment
|
86
|
+
# * comment= (Zlib::GzipWriter#comment=)
|
87
|
+
# * #crc
|
88
|
+
# * eof? (Zlib::GzipReader#eof?)
|
89
|
+
# * #finish
|
90
|
+
# * #level
|
91
|
+
# * lineno (Zlib::GzipReader#lineno)
|
92
|
+
# * lineno= (Zlib::GzipReader#lineno=)
|
93
|
+
# * #mtime
|
94
|
+
# * mtime= (Zlib::GzipWriter#mtime=)
|
95
|
+
# * #orig_name
|
96
|
+
# * orig_name (Zlib::GzipWriter#orig_name=)
|
97
|
+
# * #os_code
|
98
|
+
# * path (when the underlying IO supports #path)
|
99
|
+
# * #sync
|
100
|
+
# * #sync=
|
101
|
+
# * #to_io
|
102
|
+
#
|
103
|
+
#
|
104
|
+
# (due to internal structure, documentation may appear under Zlib::GzipReader or
|
105
|
+
# Zlib::GzipWriter)
|
106
|
+
#
|
107
|
+
class GzipFile
|
108
|
+
# <!-- rdoc-file=ext/zlib/zlib.c -->
|
109
|
+
# Raised when gzip file footer is not found.
|
110
|
+
#
|
111
|
+
class NoFooter < Zlib::GzipFile::Error
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
@@ -0,0 +1,228 @@
|
|
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::GzipFile is an abstract class for handling a gzip formatted compressed
|
74
|
+
# file. The operations are defined in the subclasses, Zlib::GzipReader for
|
75
|
+
# reading, and Zlib::GzipWriter for writing.
|
76
|
+
#
|
77
|
+
# GzipReader should be used by associating an IO, or IO-like, object.
|
78
|
+
#
|
79
|
+
# ## Method Catalogue
|
80
|
+
#
|
81
|
+
# * ::wrap
|
82
|
+
# * ::open (Zlib::GzipReader::open and Zlib::GzipWriter::open)
|
83
|
+
# * #close
|
84
|
+
# * #closed?
|
85
|
+
# * #comment
|
86
|
+
# * comment= (Zlib::GzipWriter#comment=)
|
87
|
+
# * #crc
|
88
|
+
# * eof? (Zlib::GzipReader#eof?)
|
89
|
+
# * #finish
|
90
|
+
# * #level
|
91
|
+
# * lineno (Zlib::GzipReader#lineno)
|
92
|
+
# * lineno= (Zlib::GzipReader#lineno=)
|
93
|
+
# * #mtime
|
94
|
+
# * mtime= (Zlib::GzipWriter#mtime=)
|
95
|
+
# * #orig_name
|
96
|
+
# * orig_name (Zlib::GzipWriter#orig_name=)
|
97
|
+
# * #os_code
|
98
|
+
# * path (when the underlying IO supports #path)
|
99
|
+
# * #sync
|
100
|
+
# * #sync=
|
101
|
+
# * #to_io
|
102
|
+
#
|
103
|
+
#
|
104
|
+
# (due to internal structure, documentation may appear under Zlib::GzipReader or
|
105
|
+
# Zlib::GzipWriter)
|
106
|
+
#
|
107
|
+
class GzipFile
|
108
|
+
# <!--
|
109
|
+
# rdoc-file=ext/zlib/zlib.c
|
110
|
+
# - Zlib::GzipReader.wrap(io, ...) { |gz| ... }
|
111
|
+
# - Zlib::GzipWriter.wrap(io, ...) { |gz| ... }
|
112
|
+
# -->
|
113
|
+
# Creates a GzipReader or GzipWriter associated with `io`, passing in any
|
114
|
+
# necessary extra options, and executes the block with the newly created object
|
115
|
+
# just like File.open.
|
116
|
+
#
|
117
|
+
# The GzipFile object will be closed automatically after executing the block. If
|
118
|
+
# you want to keep the associated IO object open, you may call
|
119
|
+
# Zlib::GzipFile#finish method in the block.
|
120
|
+
#
|
121
|
+
def self.wrap: (IO io, *untyped) { (instance gz) -> void } -> void
|
122
|
+
|
123
|
+
public
|
124
|
+
|
125
|
+
# <!--
|
126
|
+
# rdoc-file=ext/zlib/zlib.c
|
127
|
+
# - close()
|
128
|
+
# -->
|
129
|
+
# Closes the GzipFile object. This method calls close method of the associated
|
130
|
+
# IO object. Returns the associated IO object.
|
131
|
+
#
|
132
|
+
def close: () -> void
|
133
|
+
|
134
|
+
# <!--
|
135
|
+
# rdoc-file=ext/zlib/zlib.c
|
136
|
+
# - closed?()
|
137
|
+
# -->
|
138
|
+
# Same as IO#closed?
|
139
|
+
#
|
140
|
+
def closed?: () -> void
|
141
|
+
|
142
|
+
# <!--
|
143
|
+
# rdoc-file=ext/zlib/zlib.c
|
144
|
+
# - comment()
|
145
|
+
# -->
|
146
|
+
# Returns comments recorded in the gzip file header, or nil if the comments is
|
147
|
+
# not present.
|
148
|
+
#
|
149
|
+
def comment: () -> String?
|
150
|
+
|
151
|
+
# <!--
|
152
|
+
# rdoc-file=ext/zlib/zlib.c
|
153
|
+
# - crc()
|
154
|
+
# -->
|
155
|
+
# Returns CRC value of the uncompressed data.
|
156
|
+
#
|
157
|
+
def crc: () -> Integer
|
158
|
+
|
159
|
+
# <!--
|
160
|
+
# rdoc-file=ext/zlib/zlib.c
|
161
|
+
# - finish()
|
162
|
+
# -->
|
163
|
+
# Closes the GzipFile object. Unlike Zlib::GzipFile#close, this method never
|
164
|
+
# calls the close method of the associated IO object. Returns the associated IO
|
165
|
+
# object.
|
166
|
+
#
|
167
|
+
def finish: () -> IO
|
168
|
+
|
169
|
+
# <!--
|
170
|
+
# rdoc-file=ext/zlib/zlib.c
|
171
|
+
# - level()
|
172
|
+
# -->
|
173
|
+
# Returns compression level.
|
174
|
+
#
|
175
|
+
def level: () -> Integer
|
176
|
+
|
177
|
+
# <!--
|
178
|
+
# rdoc-file=ext/zlib/zlib.c
|
179
|
+
# - mtime()
|
180
|
+
# -->
|
181
|
+
# Returns last modification time recorded in the gzip file header.
|
182
|
+
#
|
183
|
+
def mtime: () -> Time
|
184
|
+
|
185
|
+
# <!--
|
186
|
+
# rdoc-file=ext/zlib/zlib.c
|
187
|
+
# - orig_name()
|
188
|
+
# -->
|
189
|
+
# Returns original filename recorded in the gzip file header, or `nil` if
|
190
|
+
# original filename is not present.
|
191
|
+
#
|
192
|
+
def orig_name: () -> String?
|
193
|
+
|
194
|
+
# <!--
|
195
|
+
# rdoc-file=ext/zlib/zlib.c
|
196
|
+
# - os_code()
|
197
|
+
# -->
|
198
|
+
# Returns OS code number recorded in the gzip file header.
|
199
|
+
#
|
200
|
+
def os_code: () -> Integer
|
201
|
+
|
202
|
+
# <!--
|
203
|
+
# rdoc-file=ext/zlib/zlib.c
|
204
|
+
# - sync()
|
205
|
+
# -->
|
206
|
+
# Same as IO#sync
|
207
|
+
#
|
208
|
+
def sync: () -> bool
|
209
|
+
|
210
|
+
# <!--
|
211
|
+
# rdoc-file=ext/zlib/zlib.c
|
212
|
+
# - sync = flag
|
213
|
+
# -->
|
214
|
+
# Same as IO. If flag is `true`, the associated IO object must respond to the
|
215
|
+
# `flush` method. While `sync` mode is `true`, the compression ratio decreases
|
216
|
+
# sharply.
|
217
|
+
#
|
218
|
+
def sync=: (boolish) -> untyped
|
219
|
+
|
220
|
+
# <!--
|
221
|
+
# rdoc-file=ext/zlib/zlib.c
|
222
|
+
# - to_io()
|
223
|
+
# -->
|
224
|
+
# Same as IO.
|
225
|
+
#
|
226
|
+
def to_io: () -> IO
|
227
|
+
end
|
228
|
+
end
|