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.
Files changed (125) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/comments.yml +1 -1
  3. data/.github/workflows/ruby.yml +7 -2
  4. data/CHANGELOG.md +85 -0
  5. data/Gemfile.lock +14 -14
  6. data/README.md +11 -2
  7. data/Rakefile +10 -7
  8. data/Steepfile +7 -7
  9. data/core/basic_object.rbs +7 -7
  10. data/core/binding.rbs +3 -3
  11. data/core/builtin.rbs +171 -5
  12. data/core/constants.rbs +17 -17
  13. data/core/dir.rbs +3 -3
  14. data/core/encoding.rbs +434 -628
  15. data/core/enumerator.rbs +37 -0
  16. data/core/exception.rbs +11 -11
  17. data/core/false_class.rbs +5 -11
  18. data/core/fiber.rbs +3 -3
  19. data/core/file_test.rbs +28 -26
  20. data/core/kernel.rbs +900 -21
  21. data/core/marshal.rbs +24 -14
  22. data/core/match_data.rbs +8 -8
  23. data/core/math.rbs +57 -53
  24. data/core/method.rbs +3 -1
  25. data/core/module.rbs +38 -36
  26. data/core/nil_class.rbs +7 -13
  27. data/core/object.rbs +3 -966
  28. data/core/process.rbs +3 -3
  29. data/core/ractor.rbs +2 -2
  30. data/core/rb_config.rbs +64 -43
  31. data/core/regexp.rbs +3 -3
  32. data/core/signal.rbs +10 -4
  33. data/core/struct.rbs +1 -1
  34. data/core/thread.rbs +7 -7
  35. data/core/thread_group.rbs +9 -9
  36. data/core/true_class.rbs +5 -11
  37. data/core/unbound_method.rbs +56 -7
  38. data/core/warning.rbs +33 -0
  39. data/docs/collection.md +56 -6
  40. data/docs/data_and_struct.md +57 -0
  41. data/docs/stdlib.md +61 -2
  42. data/docs/syntax.md +123 -2
  43. data/ext/rbs_extension/lexer.c +624 -569
  44. data/ext/rbs_extension/lexer.h +1 -0
  45. data/ext/rbs_extension/lexer.re +1 -0
  46. data/ext/rbs_extension/lexstate.c +1 -0
  47. data/ext/rbs_extension/parser.c +6 -0
  48. data/goodcheck.yml +2 -2
  49. data/lib/rbs/annotate/formatter.rb +13 -3
  50. data/lib/rbs/annotate/rdoc_source.rb +10 -1
  51. data/lib/rbs/cli/colored_io.rb +48 -0
  52. data/lib/rbs/cli/diff.rb +80 -0
  53. data/lib/rbs/cli.rb +151 -16
  54. data/lib/rbs/collection/config/lockfile.rb +0 -25
  55. data/lib/rbs/collection/config/lockfile_generator.rb +0 -6
  56. data/lib/rbs/collection/installer.rb +1 -1
  57. data/lib/rbs/collection/sources/git.rb +6 -4
  58. data/lib/rbs/collection/sources/local.rb +7 -5
  59. data/lib/rbs/diff.rb +104 -0
  60. data/lib/rbs/environment.rb +1 -1
  61. data/lib/rbs/method_type.rb +23 -0
  62. data/lib/rbs/prototype/rb.rb +2 -9
  63. data/lib/rbs/prototype/runtime/helpers.rb +59 -0
  64. data/lib/rbs/prototype/runtime/value_object_generator.rb +236 -0
  65. data/lib/rbs/prototype/runtime.rb +234 -150
  66. data/lib/rbs/sorter.rb +144 -117
  67. data/lib/rbs/test/guaranteed.rb +31 -0
  68. data/lib/rbs/test/type_check.rb +4 -4
  69. data/lib/rbs/test.rb +3 -0
  70. data/lib/rbs/types.rb +184 -3
  71. data/lib/rbs/version.rb +1 -1
  72. data/lib/rbs/writer.rb +4 -4
  73. data/lib/rbs.rb +1 -0
  74. data/rbs.gemspec +1 -0
  75. data/sig/annotate/formatter.rbs +2 -2
  76. data/sig/annotate/rdoc_annotater.rbs +1 -1
  77. data/sig/cli/colored_io.rbs +15 -0
  78. data/sig/cli/diff.rbs +21 -0
  79. data/sig/cli.rbs +2 -0
  80. data/sig/collection/config/lockfile.rbs +0 -6
  81. data/sig/diff.rbs +23 -0
  82. data/sig/errors.rbs +1 -5
  83. data/sig/method_types.rbs +6 -0
  84. data/sig/prototype/runtime.rbs +108 -0
  85. data/sig/rdoc/rbs.rbs +4 -0
  86. data/sig/shims/bundler.rbs +5 -0
  87. data/sig/sorter.rbs +23 -5
  88. data/sig/types.rbs +29 -0
  89. data/stdlib/benchmark/0/benchmark.rbs +1 -1
  90. data/stdlib/cgi/0/core.rbs +2 -2
  91. data/stdlib/did_you_mean/0/did_you_mean.rbs +2 -2
  92. data/stdlib/digest/0/digest.rbs +1 -1
  93. data/stdlib/fileutils/0/fileutils.rbs +1 -1
  94. data/stdlib/forwardable/0/forwardable.rbs +4 -4
  95. data/stdlib/io-console/0/io-console.rbs +1 -1
  96. data/stdlib/json/0/json.rbs +37 -0
  97. data/stdlib/logger/0/logger.rbs +2 -2
  98. data/stdlib/net-http/0/manifest.yaml +1 -1
  99. data/stdlib/net-http/0/net-http.rbs +16 -63
  100. data/stdlib/net-protocol/0/manifest.yaml +2 -0
  101. data/stdlib/net-protocol/0/net-protocol.rbs +56 -0
  102. data/stdlib/openssl/0/openssl.rbs +1 -1
  103. data/stdlib/pp/0/manifest.yaml +2 -0
  104. data/stdlib/pp/0/pp.rbs +301 -0
  105. data/stdlib/{yaml → psych}/0/dbm.rbs +3 -3
  106. data/stdlib/psych/0/manifest.yaml +3 -0
  107. data/stdlib/psych/0/psych.rbs +391 -0
  108. data/stdlib/{yaml → psych}/0/store.rbs +2 -2
  109. data/stdlib/rdoc/0/code_object.rbs +55 -0
  110. data/stdlib/rdoc/0/comment.rbs +60 -0
  111. data/stdlib/rdoc/0/context.rbs +153 -0
  112. data/stdlib/rdoc/0/markup.rbs +119 -0
  113. data/stdlib/rdoc/0/parser.rbs +56 -0
  114. data/stdlib/rdoc/0/rdoc.rbs +0 -372
  115. data/stdlib/rdoc/0/ri.rbs +17 -0
  116. data/stdlib/rdoc/0/store.rbs +48 -0
  117. data/stdlib/rdoc/0/top_level.rbs +97 -0
  118. data/stdlib/socket/0/basic_socket.rbs +1 -1
  119. data/stdlib/socket/0/socket.rbs +1 -1
  120. data/stdlib/uri/0/common.rbs +1 -1
  121. data/stdlib/yaml/0/manifest.yaml +1 -2
  122. data/stdlib/yaml/0/yaml.rbs +1 -199
  123. metadata +46 -9
  124. data/sig/shims/pp.rbs +0 -3
  125. 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: (?Symbol | String p_addr, ?Integer? p_port, ?String? p_user, ?String? p_pass) -> untyped
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
- type key = String | Symbol
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 []: (key key) -> (nil | String)
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 []=: (key key, untyped val) -> void
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: (key key, untyped val) -> void
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: (key key, untyped val) -> void
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: (key key) -> (nil | Array[String])
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: (key key) -> String
1954
- | (key key, untyped) -> untyped
1955
- | (key key) { (String) -> untyped } -> untyped
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: (key key) -> (Array[String] | nil)
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?: (key key) -> bool
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: (key name) -> String
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: (key `type`, ?Hash[untyped, untyped] params) -> void
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,2 @@
1
+ dependencies:
2
+ - name: timeout
@@ -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: (Symbol | String | Integer how) -> void
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
@@ -0,0 +1,2 @@
1
+ dependencies:
2
+ - name: prettyprint
@@ -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 YAML
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) -> YAML::DBM
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]) -> YAML::DBM
217
+ def update: (Hash[untyped, untyped]) -> Psych::DBM
218
218
 
219
219
  # <!--
220
220
  # rdoc-file=lib/yaml/dbm.rb
@@ -0,0 +1,3 @@
1
+ dependencies:
2
+ - name: dbm
3
+ - name: pstore