rbs 3.2.2 → 3.3.0.pre.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/comments.yml +1 -1
- data/.github/workflows/ruby.yml +7 -2
- data/CHANGELOG.md +85 -0
- data/Gemfile.lock +14 -14
- data/README.md +11 -2
- data/Rakefile +10 -7
- data/Steepfile +7 -7
- data/core/basic_object.rbs +7 -7
- data/core/binding.rbs +3 -3
- data/core/builtin.rbs +171 -5
- data/core/constants.rbs +17 -17
- data/core/dir.rbs +3 -3
- data/core/encoding.rbs +434 -628
- data/core/enumerator.rbs +37 -0
- data/core/exception.rbs +11 -11
- data/core/false_class.rbs +5 -11
- data/core/fiber.rbs +3 -3
- data/core/file_test.rbs +28 -26
- data/core/kernel.rbs +900 -21
- data/core/marshal.rbs +24 -14
- data/core/match_data.rbs +8 -8
- data/core/math.rbs +57 -53
- data/core/method.rbs +3 -1
- data/core/module.rbs +38 -36
- data/core/nil_class.rbs +7 -13
- data/core/object.rbs +3 -966
- data/core/process.rbs +3 -3
- data/core/ractor.rbs +2 -2
- data/core/rb_config.rbs +64 -43
- data/core/regexp.rbs +3 -3
- data/core/signal.rbs +10 -4
- data/core/struct.rbs +1 -1
- data/core/thread.rbs +7 -7
- data/core/thread_group.rbs +9 -9
- data/core/true_class.rbs +5 -11
- data/core/unbound_method.rbs +56 -7
- data/core/warning.rbs +33 -0
- data/docs/collection.md +56 -6
- data/docs/data_and_struct.md +57 -0
- data/docs/stdlib.md +61 -2
- data/docs/syntax.md +123 -2
- data/ext/rbs_extension/lexer.c +624 -569
- data/ext/rbs_extension/lexer.h +1 -0
- data/ext/rbs_extension/lexer.re +1 -0
- data/ext/rbs_extension/lexstate.c +1 -0
- data/ext/rbs_extension/parser.c +6 -0
- data/goodcheck.yml +2 -2
- data/lib/rbs/annotate/formatter.rb +13 -3
- data/lib/rbs/annotate/rdoc_source.rb +10 -1
- data/lib/rbs/cli/colored_io.rb +48 -0
- data/lib/rbs/cli/diff.rb +80 -0
- data/lib/rbs/cli.rb +151 -16
- data/lib/rbs/collection/config/lockfile.rb +0 -25
- data/lib/rbs/collection/config/lockfile_generator.rb +0 -6
- data/lib/rbs/collection/installer.rb +1 -1
- data/lib/rbs/collection/sources/git.rb +6 -4
- data/lib/rbs/collection/sources/local.rb +7 -5
- data/lib/rbs/diff.rb +104 -0
- data/lib/rbs/environment.rb +1 -1
- data/lib/rbs/method_type.rb +23 -0
- data/lib/rbs/prototype/rb.rb +2 -9
- data/lib/rbs/prototype/runtime/helpers.rb +59 -0
- data/lib/rbs/prototype/runtime/value_object_generator.rb +236 -0
- data/lib/rbs/prototype/runtime.rb +234 -150
- data/lib/rbs/sorter.rb +144 -117
- data/lib/rbs/test/guaranteed.rb +31 -0
- data/lib/rbs/test/type_check.rb +4 -4
- data/lib/rbs/test.rb +3 -0
- data/lib/rbs/types.rb +184 -3
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs/writer.rb +4 -4
- data/lib/rbs.rb +1 -0
- data/rbs.gemspec +1 -0
- data/sig/annotate/formatter.rbs +2 -2
- data/sig/annotate/rdoc_annotater.rbs +1 -1
- data/sig/cli/colored_io.rbs +15 -0
- data/sig/cli/diff.rbs +21 -0
- data/sig/cli.rbs +2 -0
- data/sig/collection/config/lockfile.rbs +0 -6
- data/sig/diff.rbs +23 -0
- data/sig/errors.rbs +1 -5
- data/sig/method_types.rbs +6 -0
- data/sig/prototype/runtime.rbs +108 -0
- data/sig/rdoc/rbs.rbs +4 -0
- data/sig/shims/bundler.rbs +5 -0
- data/sig/sorter.rbs +23 -5
- data/sig/types.rbs +29 -0
- data/stdlib/benchmark/0/benchmark.rbs +1 -1
- data/stdlib/cgi/0/core.rbs +2 -2
- data/stdlib/did_you_mean/0/did_you_mean.rbs +2 -2
- data/stdlib/digest/0/digest.rbs +1 -1
- data/stdlib/fileutils/0/fileutils.rbs +1 -1
- data/stdlib/forwardable/0/forwardable.rbs +4 -4
- data/stdlib/io-console/0/io-console.rbs +1 -1
- data/stdlib/json/0/json.rbs +37 -0
- data/stdlib/logger/0/logger.rbs +2 -2
- data/stdlib/net-http/0/manifest.yaml +1 -1
- data/stdlib/net-http/0/net-http.rbs +16 -63
- data/stdlib/net-protocol/0/manifest.yaml +2 -0
- data/stdlib/net-protocol/0/net-protocol.rbs +56 -0
- data/stdlib/openssl/0/openssl.rbs +1 -1
- data/stdlib/pp/0/manifest.yaml +2 -0
- data/stdlib/pp/0/pp.rbs +301 -0
- data/stdlib/{yaml → psych}/0/dbm.rbs +3 -3
- data/stdlib/psych/0/manifest.yaml +3 -0
- data/stdlib/psych/0/psych.rbs +391 -0
- data/stdlib/{yaml → psych}/0/store.rbs +2 -2
- data/stdlib/rdoc/0/code_object.rbs +55 -0
- data/stdlib/rdoc/0/comment.rbs +60 -0
- data/stdlib/rdoc/0/context.rbs +153 -0
- data/stdlib/rdoc/0/markup.rbs +119 -0
- data/stdlib/rdoc/0/parser.rbs +56 -0
- data/stdlib/rdoc/0/rdoc.rbs +0 -372
- data/stdlib/rdoc/0/ri.rbs +17 -0
- data/stdlib/rdoc/0/store.rbs +48 -0
- data/stdlib/rdoc/0/top_level.rbs +97 -0
- data/stdlib/socket/0/basic_socket.rbs +1 -1
- data/stdlib/socket/0/socket.rbs +1 -1
- data/stdlib/uri/0/common.rbs +1 -1
- data/stdlib/yaml/0/manifest.yaml +1 -2
- data/stdlib/yaml/0/yaml.rbs +1 -199
- metadata +46 -9
- data/sig/shims/pp.rbs +0 -3
- data/sig/shims.rbs +0 -47
@@ -1,59 +1,10 @@
|
|
1
1
|
module Net
|
2
|
-
class Protocol
|
3
|
-
VERSION: String
|
4
|
-
end
|
5
|
-
|
6
|
-
class ProtocolError < StandardError
|
7
|
-
end
|
8
|
-
|
9
|
-
class ProtoSyntaxError < ProtocolError
|
10
|
-
end
|
11
|
-
|
12
|
-
class ProtoFatalError < ProtocolError
|
13
|
-
end
|
14
|
-
|
15
|
-
class ProtoUnknownError < ProtocolError
|
16
|
-
end
|
17
|
-
|
18
|
-
class ProtoServerError < ProtocolError
|
19
|
-
end
|
20
|
-
|
21
|
-
class ProtoAuthError < ProtocolError
|
22
|
-
end
|
23
|
-
|
24
|
-
class ProtoCommandError < ProtocolError
|
25
|
-
end
|
26
|
-
|
27
|
-
class ProtoRetriableError < ProtocolError
|
28
|
-
end
|
29
|
-
|
30
2
|
class HTTPBadResponse < StandardError
|
31
3
|
end
|
32
4
|
|
33
5
|
class HTTPHeaderSyntaxError < StandardError
|
34
6
|
end
|
35
7
|
|
36
|
-
# <!-- rdoc-file=lib/net/protocol.rb -->
|
37
|
-
# OpenTimeout, a subclass of Timeout::Error, is raised if a connection cannot be
|
38
|
-
# created within the open_timeout.
|
39
|
-
#
|
40
|
-
class OpenTimeout < Timeout::Error
|
41
|
-
end
|
42
|
-
|
43
|
-
# <!-- rdoc-file=lib/net/protocol.rb -->
|
44
|
-
# ReadTimeout, a subclass of Timeout::Error, is raised if a chunk of the
|
45
|
-
# response cannot be read within the read_timeout.
|
46
|
-
#
|
47
|
-
class ReadTimeout < Timeout::Error
|
48
|
-
end
|
49
|
-
|
50
|
-
# <!-- rdoc-file=lib/net/protocol.rb -->
|
51
|
-
# WriteTimeout, a subclass of Timeout::Error, is raised if a chunk of the
|
52
|
-
# response cannot be written within the write_timeout. Not raised on Windows.
|
53
|
-
#
|
54
|
-
class WriteTimeout < Timeout::Error
|
55
|
-
end
|
56
|
-
|
57
8
|
# <!-- rdoc-file=lib/net/http.rb -->
|
58
9
|
# Class Net::HTTP provides a rich library that implements the client in a
|
59
10
|
# client-server model that uses the HTTP request-response protocol. For
|
@@ -1128,7 +1079,7 @@ module Net
|
|
1128
1079
|
# This class is obsolete. You may pass these same parameters directly to
|
1129
1080
|
# Net::HTTP.new. See Net::HTTP.new for details of the arguments.
|
1130
1081
|
#
|
1131
|
-
def self.Proxy: (?
|
1082
|
+
def self.Proxy: (?interned p_addr, ?Integer? p_port, ?String? p_user, ?String? p_pass) -> untyped
|
1132
1083
|
|
1133
1084
|
# <!--
|
1134
1085
|
# rdoc-file=lib/net/http.rb
|
@@ -1836,7 +1787,9 @@ module Net
|
|
1836
1787
|
|
1837
1788
|
alias length size
|
1838
1789
|
|
1839
|
-
|
1790
|
+
# A previous incarnation of `interned` for backward-compatibility (see #1499)
|
1791
|
+
%a{steep:deprecated}
|
1792
|
+
type key = interned
|
1840
1793
|
|
1841
1794
|
# <!--
|
1842
1795
|
# rdoc-file=lib/net/http/header.rb
|
@@ -1852,7 +1805,7 @@ module Net
|
|
1852
1805
|
# Note that some field values may be retrieved via convenience methods; see
|
1853
1806
|
# [Getters](rdoc-ref:Net::HTTPHeader@Getters).
|
1854
1807
|
#
|
1855
|
-
def []: (
|
1808
|
+
def []: (interned key) -> (nil | String)
|
1856
1809
|
|
1857
1810
|
# <!--
|
1858
1811
|
# rdoc-file=lib/net/http/header.rb
|
@@ -1870,7 +1823,7 @@ module Net
|
|
1870
1823
|
# Note that some field values may be set via convenience methods; see
|
1871
1824
|
# [Setters](rdoc-ref:Net::HTTPHeader@Setters).
|
1872
1825
|
#
|
1873
|
-
def []=: (
|
1826
|
+
def []=: (interned key, untyped val) -> void
|
1874
1827
|
|
1875
1828
|
# <!--
|
1876
1829
|
# rdoc-file=lib/net/http/header.rb
|
@@ -1889,7 +1842,7 @@ module Net
|
|
1889
1842
|
# req['Foo'] # => "bar, baz, baz, bam"
|
1890
1843
|
# req.get_fields('Foo') # => ["bar", "baz", "baz", "bam"]
|
1891
1844
|
#
|
1892
|
-
def add_field: (
|
1845
|
+
def add_field: (interned key, untyped val) -> void
|
1893
1846
|
|
1894
1847
|
private
|
1895
1848
|
|
@@ -1898,7 +1851,7 @@ module Net
|
|
1898
1851
|
# - set_field(key, val)
|
1899
1852
|
# -->
|
1900
1853
|
#
|
1901
|
-
def set_field: (
|
1854
|
+
def set_field: (interned key, untyped val) -> void
|
1902
1855
|
|
1903
1856
|
# <!--
|
1904
1857
|
# rdoc-file=lib/net/http/header.rb
|
@@ -1920,7 +1873,7 @@ module Net
|
|
1920
1873
|
# res.get_fields('Connection') # => ["keep-alive"]
|
1921
1874
|
# res.get_fields('Nosuch') # => nil
|
1922
1875
|
#
|
1923
|
-
def get_fields: (
|
1876
|
+
def get_fields: (interned key) -> (nil | Array[String])
|
1924
1877
|
|
1925
1878
|
# <!--
|
1926
1879
|
# rdoc-file=lib/net/http/header.rb
|
@@ -1950,9 +1903,9 @@ module Net
|
|
1950
1903
|
# res.fetch('Nosuch', 'Foo') # => "Foo"
|
1951
1904
|
# res.fetch('Nosuch') # Raises KeyError.
|
1952
1905
|
#
|
1953
|
-
def fetch: (
|
1954
|
-
| (
|
1955
|
-
| (
|
1906
|
+
def fetch: (interned key) -> String
|
1907
|
+
| (interned key, untyped) -> untyped
|
1908
|
+
| (interned key) { (String) -> untyped } -> untyped
|
1956
1909
|
|
1957
1910
|
# <!--
|
1958
1911
|
# rdoc-file=lib/net/http/header.rb
|
@@ -2081,7 +2034,7 @@ module Net
|
|
2081
2034
|
# req.delete('Accept') # => ["*/*"]
|
2082
2035
|
# req.delete('Nosuch') # => nil
|
2083
2036
|
#
|
2084
|
-
def delete: (
|
2037
|
+
def delete: (interned key) -> (Array[String] | nil)
|
2085
2038
|
|
2086
2039
|
# <!--
|
2087
2040
|
# rdoc-file=lib/net/http/header.rb
|
@@ -2094,7 +2047,7 @@ module Net
|
|
2094
2047
|
# req.key?('Accept') # => true
|
2095
2048
|
# req.key?('Nosuch') # => false
|
2096
2049
|
#
|
2097
|
-
def key?: (
|
2050
|
+
def key?: (interned key) -> bool
|
2098
2051
|
|
2099
2052
|
# <!--
|
2100
2053
|
# rdoc-file=lib/net/http/header.rb
|
@@ -2138,7 +2091,7 @@ module Net
|
|
2138
2091
|
# - capitalize(name)
|
2139
2092
|
# -->
|
2140
2093
|
#
|
2141
|
-
def capitalize: (
|
2094
|
+
def capitalize: (interned name) -> String
|
2142
2095
|
|
2143
2096
|
public
|
2144
2097
|
|
@@ -2361,7 +2314,7 @@ module Net
|
|
2361
2314
|
# Net::HTTPHeader#content_type= is an alias for
|
2362
2315
|
# Net::HTTPHeader#set_content_type.
|
2363
2316
|
#
|
2364
|
-
def set_content_type: (
|
2317
|
+
def set_content_type: (interned `type`, ?Hash[untyped, untyped] params) -> void
|
2365
2318
|
|
2366
2319
|
# <!--
|
2367
2320
|
# rdoc-file=lib/net/http/header.rb
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module Net
|
2
|
+
class Protocol
|
3
|
+
VERSION: String
|
4
|
+
end
|
5
|
+
|
6
|
+
class ProtocolError < StandardError
|
7
|
+
end
|
8
|
+
|
9
|
+
class ProtoSyntaxError < ProtocolError
|
10
|
+
end
|
11
|
+
|
12
|
+
class ProtoFatalError < ProtocolError
|
13
|
+
end
|
14
|
+
|
15
|
+
class ProtoUnknownError < ProtocolError
|
16
|
+
end
|
17
|
+
|
18
|
+
class ProtoServerError < ProtocolError
|
19
|
+
end
|
20
|
+
|
21
|
+
class ProtoAuthError < ProtocolError
|
22
|
+
end
|
23
|
+
|
24
|
+
class ProtoCommandError < ProtocolError
|
25
|
+
end
|
26
|
+
|
27
|
+
class ProtoRetriableError < ProtocolError
|
28
|
+
end
|
29
|
+
|
30
|
+
class HTTPBadResponse < StandardError
|
31
|
+
end
|
32
|
+
|
33
|
+
class HTTPHeaderSyntaxError < StandardError
|
34
|
+
end
|
35
|
+
|
36
|
+
# <!-- rdoc-file=lib/net/protocol.rb -->
|
37
|
+
# OpenTimeout, a subclass of Timeout::Error, is raised if a connection cannot be
|
38
|
+
# created within the open_timeout.
|
39
|
+
#
|
40
|
+
class OpenTimeout < Timeout::Error
|
41
|
+
end
|
42
|
+
|
43
|
+
# <!-- rdoc-file=lib/net/protocol.rb -->
|
44
|
+
# ReadTimeout, a subclass of Timeout::Error, is raised if a chunk of the
|
45
|
+
# response cannot be read within the read_timeout.
|
46
|
+
#
|
47
|
+
class ReadTimeout < Timeout::Error
|
48
|
+
end
|
49
|
+
|
50
|
+
# <!-- rdoc-file=lib/net/protocol.rb -->
|
51
|
+
# WriteTimeout, a subclass of Timeout::Error, is raised if a chunk of the
|
52
|
+
# response cannot be written within the write_timeout. Not raised on Windows.
|
53
|
+
#
|
54
|
+
class WriteTimeout < Timeout::Error
|
55
|
+
end
|
56
|
+
end
|
@@ -8418,7 +8418,7 @@ module OpenSSL
|
|
8418
8418
|
# -->
|
8419
8419
|
# See BasicSocket#shutdown for details.
|
8420
8420
|
#
|
8421
|
-
def shutdown: (
|
8421
|
+
def shutdown: (interned | Integer how) -> void
|
8422
8422
|
|
8423
8423
|
# <!-- rdoc-file=ext/openssl/lib/openssl/ssl.rb -->
|
8424
8424
|
# When true then #accept works exactly the same as TCPServer#accept
|
data/stdlib/pp/0/pp.rbs
ADDED
@@ -0,0 +1,301 @@
|
|
1
|
+
# <!-- rdoc-file=lib/pp.rb -->
|
2
|
+
# A pretty-printer for Ruby objects.
|
3
|
+
#
|
4
|
+
# ## What PP Does
|
5
|
+
#
|
6
|
+
# Standard output by #p returns this:
|
7
|
+
# #<PP:0x81fedf0 @genspace=#<Proc:0x81feda0>, @group_queue=#<PrettyPrint::GroupQueue:0x81fed3c @queue=[[#<PrettyPrint::Group:0x81fed78 @breakables=[], @depth=0, @break=false>], []]>, @buffer=[], @newline="\n", @group_stack=[#<PrettyPrint::Group:0x81fed78 @breakables=[], @depth=0, @break=false>], @buffer_width=0, @indent=0, @maxwidth=79, @output_width=2, @output=#<IO:0x8114ee4>>
|
8
|
+
#
|
9
|
+
# Pretty-printed output returns this:
|
10
|
+
# #<PP:0x81fedf0
|
11
|
+
# @buffer=[],
|
12
|
+
# @buffer_width=0,
|
13
|
+
# @genspace=#<Proc:0x81feda0>,
|
14
|
+
# @group_queue=
|
15
|
+
# #<PrettyPrint::GroupQueue:0x81fed3c
|
16
|
+
# @queue=
|
17
|
+
# [[#<PrettyPrint::Group:0x81fed78 @break=false, @breakables=[], @depth=0>],
|
18
|
+
# []]>,
|
19
|
+
# @group_stack=
|
20
|
+
# [#<PrettyPrint::Group:0x81fed78 @break=false, @breakables=[], @depth=0>],
|
21
|
+
# @indent=0,
|
22
|
+
# @maxwidth=79,
|
23
|
+
# @newline="\n",
|
24
|
+
# @output=#<IO:0x8114ee4>,
|
25
|
+
# @output_width=2>
|
26
|
+
#
|
27
|
+
# ## Usage
|
28
|
+
#
|
29
|
+
# pp(obj) #=> obj
|
30
|
+
# pp obj #=> obj
|
31
|
+
# pp(obj1, obj2, ...) #=> [obj1, obj2, ...]
|
32
|
+
# pp() #=> nil
|
33
|
+
#
|
34
|
+
# Output `obj(s)` to `$>` in pretty printed format.
|
35
|
+
#
|
36
|
+
# It returns `obj(s)`.
|
37
|
+
#
|
38
|
+
# ## Output Customization
|
39
|
+
#
|
40
|
+
# To define a customized pretty printing function for your classes, redefine
|
41
|
+
# method `#pretty_print(pp)` in the class.
|
42
|
+
#
|
43
|
+
# `#pretty_print` takes the `pp` argument, which is an instance of the PP class.
|
44
|
+
# The method uses #text, #breakable, #nest, #group and #pp to print the object.
|
45
|
+
#
|
46
|
+
# ## Pretty-Print JSON
|
47
|
+
#
|
48
|
+
# To pretty-print JSON refer to JSON#pretty_generate.
|
49
|
+
#
|
50
|
+
# ## Author
|
51
|
+
# Tanaka Akira <akr@fsij.org>
|
52
|
+
#
|
53
|
+
class PP < PrettyPrint
|
54
|
+
interface _PrettyPrint
|
55
|
+
def pretty_print: (untyped q) -> untyped
|
56
|
+
|
57
|
+
def pretty_print_cycle: (untyped q) -> untyped
|
58
|
+
|
59
|
+
def is_a?: (Module) -> bool
|
60
|
+
end
|
61
|
+
|
62
|
+
interface _LeftShift
|
63
|
+
def <<: (untyped obj) -> self
|
64
|
+
end
|
65
|
+
|
66
|
+
interface _PPMethodsRequired
|
67
|
+
def text: (String obj, ?Integer width) -> void
|
68
|
+
|
69
|
+
def breakable: (?String sep, ?Integer width) -> void
|
70
|
+
|
71
|
+
def group: (?Integer indent, ?String open_obj, ?String close_obj, ?Integer open_width, ?Integer close_width) { () -> untyped } -> void
|
72
|
+
end
|
73
|
+
|
74
|
+
module PPMethods : _PPMethodsRequired
|
75
|
+
# <!--
|
76
|
+
# rdoc-file=lib/pp.rb
|
77
|
+
# - guard_inspect_key() { || ... }
|
78
|
+
# -->
|
79
|
+
# Yields to a block and preserves the previous set of objects being printed.
|
80
|
+
#
|
81
|
+
def guard_inspect_key: () { () -> untyped } -> void
|
82
|
+
|
83
|
+
# <!--
|
84
|
+
# rdoc-file=lib/pp.rb
|
85
|
+
# - check_inspect_key(id)
|
86
|
+
# -->
|
87
|
+
# Check whether the object_id `id` is in the current buffer of objects to be
|
88
|
+
# pretty printed. Used to break cycles in chains of objects to be pretty
|
89
|
+
# printed.
|
90
|
+
#
|
91
|
+
def check_inspect_key: (_PrettyPrint id) -> bool
|
92
|
+
|
93
|
+
# <!--
|
94
|
+
# rdoc-file=lib/pp.rb
|
95
|
+
# - push_inspect_key(id)
|
96
|
+
# -->
|
97
|
+
# Adds the object_id `id` to the set of objects being pretty printed, so as to
|
98
|
+
# not repeat objects.
|
99
|
+
#
|
100
|
+
def push_inspect_key: (_PrettyPrint id) -> void
|
101
|
+
|
102
|
+
# <!--
|
103
|
+
# rdoc-file=lib/pp.rb
|
104
|
+
# - pop_inspect_key(id)
|
105
|
+
# -->
|
106
|
+
# Removes an object from the set of objects being pretty printed.
|
107
|
+
#
|
108
|
+
def pop_inspect_key: (_PrettyPrint id) -> void
|
109
|
+
|
110
|
+
# <!--
|
111
|
+
# rdoc-file=lib/pp.rb
|
112
|
+
# - pp(obj)
|
113
|
+
# -->
|
114
|
+
# Adds `obj` to the pretty printing buffer using Object#pretty_print or
|
115
|
+
# Object#pretty_print_cycle.
|
116
|
+
#
|
117
|
+
# Object#pretty_print_cycle is used when `obj` is already printed, a.k.a the
|
118
|
+
# object reference chain has a cycle.
|
119
|
+
#
|
120
|
+
def pp: (_PrettyPrint obj) -> untyped
|
121
|
+
|
122
|
+
# <!--
|
123
|
+
# rdoc-file=lib/pp.rb
|
124
|
+
# - object_group(obj) { || ... }
|
125
|
+
# -->
|
126
|
+
# A convenience method which is same as follows:
|
127
|
+
#
|
128
|
+
# group(1, '#<' + obj.class.name, '>') { ... }
|
129
|
+
#
|
130
|
+
def object_group: (untyped obj) { () -> untyped } -> Integer
|
131
|
+
|
132
|
+
# <!--
|
133
|
+
# rdoc-file=lib/pp.rb
|
134
|
+
# - object_address_group(obj, &block)
|
135
|
+
# -->
|
136
|
+
# A convenience method, like object_group, but also reformats the Object's
|
137
|
+
# object_id.
|
138
|
+
#
|
139
|
+
def object_address_group: (untyped obj) { () -> untyped } -> Integer
|
140
|
+
|
141
|
+
# <!--
|
142
|
+
# rdoc-file=lib/pp.rb
|
143
|
+
# - comma_breakable()
|
144
|
+
# -->
|
145
|
+
# A convenience method which is same as follows:
|
146
|
+
#
|
147
|
+
# text ','
|
148
|
+
# breakable
|
149
|
+
#
|
150
|
+
def comma_breakable: () -> void
|
151
|
+
|
152
|
+
# <!--
|
153
|
+
# rdoc-file=lib/pp.rb
|
154
|
+
# - seplist(list, sep=nil, iter_method=:each) { |element| ... }
|
155
|
+
# -->
|
156
|
+
# Adds a separated list. The list is separated by comma with breakable space, by
|
157
|
+
# default.
|
158
|
+
#
|
159
|
+
# #seplist iterates the `list` using `iter_method`. It yields each object to the
|
160
|
+
# block given for #seplist. The procedure `separator_proc` is called between
|
161
|
+
# each yields.
|
162
|
+
#
|
163
|
+
# If the iteration is zero times, `separator_proc` is not called at all.
|
164
|
+
#
|
165
|
+
# If `separator_proc` is nil or not given, +lambda { comma_breakable }+ is used.
|
166
|
+
# If `iter_method` is not given, :each is used.
|
167
|
+
#
|
168
|
+
# For example, following 3 code fragments has similar effect.
|
169
|
+
#
|
170
|
+
# q.seplist([1,2,3]) {|v| xxx v }
|
171
|
+
#
|
172
|
+
# q.seplist([1,2,3], lambda { q.comma_breakable }, :each) {|v| xxx v }
|
173
|
+
#
|
174
|
+
# xxx 1
|
175
|
+
# q.comma_breakable
|
176
|
+
# xxx 2
|
177
|
+
# q.comma_breakable
|
178
|
+
# xxx 3
|
179
|
+
#
|
180
|
+
def seplist: (untyped list, ?(^() -> void)? sep, ?interned iter_method) { (*untyped, **untyped) -> void } -> void
|
181
|
+
|
182
|
+
# <!--
|
183
|
+
# rdoc-file=lib/pp.rb
|
184
|
+
# - pp_object(obj)
|
185
|
+
# -->
|
186
|
+
# A present standard failsafe for pretty printing any given Object
|
187
|
+
#
|
188
|
+
def pp_object: (untyped obj) -> untyped
|
189
|
+
|
190
|
+
# <!--
|
191
|
+
# rdoc-file=lib/pp.rb
|
192
|
+
# - pp_hash(obj)
|
193
|
+
# -->
|
194
|
+
# A pretty print for a Hash
|
195
|
+
#
|
196
|
+
def pp_hash: (untyped obj) -> untyped
|
197
|
+
end
|
198
|
+
include PPMethods
|
199
|
+
|
200
|
+
class SingleLine < ::PrettyPrint::SingleLine
|
201
|
+
include PPMethods
|
202
|
+
end
|
203
|
+
|
204
|
+
module ObjectMixin : BasicObject
|
205
|
+
def pretty_print: (PP q) -> untyped
|
206
|
+
|
207
|
+
def pretty_print_cycle: (PP q) -> untyped
|
208
|
+
|
209
|
+
def pretty_print_instance_variables: () -> Array[Symbol]
|
210
|
+
|
211
|
+
def pretty_print_inspect: () -> untyped
|
212
|
+
end
|
213
|
+
|
214
|
+
# <!--
|
215
|
+
# rdoc-file=lib/pp.rb
|
216
|
+
# - width_for(out)
|
217
|
+
# -->
|
218
|
+
# Returns the usable width for `out`. As the width of `out`:
|
219
|
+
# 1. If `out` is assigned to a tty device, its width is used.
|
220
|
+
# 2. Otherwise, or it could not get the value, the `COLUMN` environment
|
221
|
+
# variable is assumed to be set to the width.
|
222
|
+
# 3. If `COLUMN` is not set to a non-zero number, 80 is assumed.
|
223
|
+
#
|
224
|
+
#
|
225
|
+
# And finally, returns the above width value - 1.
|
226
|
+
# * This -1 is for Windows command prompt, which moves the cursor to the next
|
227
|
+
# line if it reaches the last column.
|
228
|
+
#
|
229
|
+
def self.width_for: (untyped out) -> Integer
|
230
|
+
|
231
|
+
# <!--
|
232
|
+
# rdoc-file=lib/pp.rb
|
233
|
+
# - pp(obj, out=$>, width=width_for(out))
|
234
|
+
# -->
|
235
|
+
# Outputs `obj` to `out` in pretty printed format of `width` columns in width.
|
236
|
+
#
|
237
|
+
# If `out` is omitted, `$>` is assumed. If `width` is omitted, the width of
|
238
|
+
# `out` is assumed (see width_for).
|
239
|
+
#
|
240
|
+
# PP.pp returns `out`.
|
241
|
+
#
|
242
|
+
def self.pp: (_PrettyPrint obj, ?_LeftShift out, ?Integer width) -> untyped
|
243
|
+
|
244
|
+
# <!--
|
245
|
+
# rdoc-file=lib/pp.rb
|
246
|
+
# - singleline_pp(obj, out=$>)
|
247
|
+
# -->
|
248
|
+
# Outputs `obj` to `out` like PP.pp but with no indent and newline.
|
249
|
+
#
|
250
|
+
# PP.singleline_pp returns `out`.
|
251
|
+
#
|
252
|
+
def self.singleline_pp: (_PrettyPrint obj, ?_LeftShift out) -> untyped
|
253
|
+
def self.mcall: (untyped obj, Module mod, interned meth, *untyped args) ?{ (*untyped, **untyped) -> untyped } -> untyped
|
254
|
+
|
255
|
+
# <!--
|
256
|
+
# rdoc-file=lib/pp.rb
|
257
|
+
# - sharing_detection()
|
258
|
+
# -->
|
259
|
+
# Returns the sharing detection flag as a boolean value. It is false (nil) by
|
260
|
+
# default.
|
261
|
+
# ----
|
262
|
+
# <!--
|
263
|
+
# rdoc-file=lib/pp.rb
|
264
|
+
# - sharing_detection=(b)
|
265
|
+
# -->
|
266
|
+
# Sets the sharing detection flag to b.
|
267
|
+
#
|
268
|
+
attr_accessor self.sharing_detection: bool?
|
269
|
+
end
|
270
|
+
|
271
|
+
%a{annotate:rdoc:skip}
|
272
|
+
class RubyVM::AbstractSyntaxTree::Node
|
273
|
+
# <!--
|
274
|
+
# rdoc-file=lib/pp.rb
|
275
|
+
# - pretty_print_children(q, names = [])
|
276
|
+
# -->
|
277
|
+
#
|
278
|
+
def pretty_print_children: (PP q, ?Array[untyped] names) -> void
|
279
|
+
end
|
280
|
+
|
281
|
+
%a{annotate:rdoc:skip}
|
282
|
+
class Object
|
283
|
+
include PP::ObjectMixin
|
284
|
+
end
|
285
|
+
|
286
|
+
%a{annotate:rdoc:skip}
|
287
|
+
module Kernel
|
288
|
+
# <!--
|
289
|
+
# rdoc-file=lib/pp.rb
|
290
|
+
# - pretty_inspect()
|
291
|
+
# -->
|
292
|
+
# Returns a pretty printed object as a string.
|
293
|
+
#
|
294
|
+
# In order to use this method you must first require the PP module:
|
295
|
+
#
|
296
|
+
# require 'pp'
|
297
|
+
#
|
298
|
+
# See the PP module for more information.
|
299
|
+
#
|
300
|
+
def pretty_inspect: () -> String
|
301
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
%a{annotate:rdoc:skip}
|
2
|
-
module
|
2
|
+
module Psych
|
3
3
|
# <!-- rdoc-file=lib/yaml/dbm.rb -->
|
4
4
|
# YAML + DBM = YDBM
|
5
5
|
#
|
@@ -169,7 +169,7 @@ module YAML
|
|
169
169
|
# object. Takes any object which implements the each_pair method, including Hash
|
170
170
|
# and DBM objects.
|
171
171
|
#
|
172
|
-
def replace: (Hash[untyped, untyped] | DBM hsh) ->
|
172
|
+
def replace: (Hash[untyped, untyped] | DBM hsh) -> Psych::DBM
|
173
173
|
|
174
174
|
# <!--
|
175
175
|
# rdoc-file=lib/yaml/dbm.rb
|
@@ -214,7 +214,7 @@ module YAML
|
|
214
214
|
#
|
215
215
|
# Returns `self`.
|
216
216
|
#
|
217
|
-
def update: (Hash[untyped, untyped]) ->
|
217
|
+
def update: (Hash[untyped, untyped]) -> Psych::DBM
|
218
218
|
|
219
219
|
# <!--
|
220
220
|
# rdoc-file=lib/yaml/dbm.rb
|