rbs 1.5.1 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/rbs/validator.rb CHANGED
@@ -56,7 +56,10 @@ module RBS
56
56
 
57
57
  def validate_type_alias(entry:)
58
58
  @type_alias_dependency ||= TypeAliasDependency.new(env: env)
59
- raise RecursiveTypeAliasError.new(alias_names: [entry.decl.name], location: entry.decl.location) if @type_alias_dependency.circular_definition?(entry.decl.name)
59
+ if @type_alias_dependency.circular_definition?(entry.decl.name)
60
+ location = entry.decl.location or raise
61
+ raise RecursiveTypeAliasError.new(alias_names: [entry.decl.name], location: location)
62
+ end
60
63
  end
61
64
  end
62
65
  end
data/lib/rbs/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module RBS
2
- VERSION = "1.5.1"
2
+ VERSION = "1.6.0"
3
3
  end
data/lib/rbs.rb CHANGED
@@ -45,6 +45,7 @@ require "rbs/repository"
45
45
  require "rbs/ancestor_graph"
46
46
  require "rbs/locator"
47
47
  require "rbs/type_alias_dependency"
48
+ require "rbs/collection"
48
49
 
49
50
  begin
50
51
  require "rbs/parser"
@@ -37,5 +37,6 @@ module RBS
37
37
  Regexp: Name
38
38
  TrueClass: Name
39
39
  FalseClass: Name
40
+ Numeric: Name
40
41
  end
41
42
  end
data/sig/cli.rbs CHANGED
@@ -2,6 +2,7 @@ module RBS
2
2
  class CLI
3
3
  class LibraryOptions
4
4
  attr_accessor core_root: Pathname?
5
+ attr_accessor config_path: Pathname?
5
6
 
6
7
  attr_reader libs: Array[String]
7
8
  attr_reader dirs: Array[String]
@@ -63,6 +64,10 @@ module RBS
63
64
 
64
65
  def run_test: (Array[String], LibraryOptions) -> void
65
66
 
67
+ def run_collection: (Array[String], LibraryOptions) -> void
68
+
66
69
  def test_opt: (LibraryOptions) -> String?
70
+
71
+ def collection_options: (Array[String]) -> OptionParser
67
72
  end
68
73
  end
@@ -0,0 +1,13 @@
1
+ module RBS
2
+ module Collection
3
+ class Cleaner
4
+ attr_reader lock: Config
5
+
6
+ def initialize: (lockfile_path: Pathname) -> void
7
+
8
+ def clean: () -> void
9
+
10
+ def needed?: (String gem_name, String version) -> bool
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,112 @@
1
+ module RBS
2
+ module Collection
3
+ module Sources
4
+ def self.from_config_entry: (source_entry) -> _Source
5
+
6
+ interface _Source
7
+ def has?: (Config::gem_entry) -> boolish
8
+ def versions: (Config::gem_entry) -> Array[String]
9
+ def install: (dest: Pathname, config_entry: Config::gem_entry, stdout: CLI::_IO) -> void
10
+ def to_lockfile: () -> source_entry
11
+ end
12
+
13
+ type source_entry = Git::source_entry
14
+ | Stdlib::source_entry
15
+ | Rubygems::source_entry
16
+
17
+ class Git
18
+ METADATA_FILENAME: String
19
+
20
+ type source_entry = {
21
+ 'type' => 'git',
22
+ 'name' => String,
23
+ 'remote' => String,
24
+ 'revision' => String,
25
+ 'repo_dir' => String?,
26
+ }
27
+
28
+ class CommandError < StandardError
29
+ end
30
+
31
+ attr_reader name: String
32
+ attr_reader remote: String
33
+ attr_reader repo_dir: String
34
+
35
+ def initialize: (name: String, revision: String, remote: String, repo_dir: String?) -> untyped
36
+
37
+ def has?: (Config::gem_entry) -> bool
38
+
39
+ def versions: (Config::gem_entry) -> Array[String]
40
+
41
+ def install: (dest: Pathname, config_entry: Config::gem_entry, stdout: CLI::_IO) -> void
42
+
43
+ def to_lockfile: () -> source_entry
44
+
45
+ private
46
+
47
+ def _install: (dest: Pathname , config_entry: Config::gem_entry) -> void
48
+
49
+ def setup!: (revision: String) -> void
50
+
51
+ def need_to_fetch?: (String revision ) -> bool
52
+
53
+ def git_dir: () -> Pathname
54
+
55
+ def gem_repo_dir: () -> Pathname
56
+
57
+ def with_revision: [T] () { () -> T } -> T
58
+
59
+ def resolved_revision: () -> String
60
+
61
+ def resolve_revision: () -> String
62
+
63
+ def git: (*String cmd) -> String
64
+
65
+ def sh!: (*String cmd) -> String
66
+
67
+ def format_config_entry: (Config::gem_entry) -> String
68
+ end
69
+
70
+ # signatures that are bundled in rbs gem under the stdlib/ directory
71
+ class Stdlib
72
+ type source_entry = {
73
+ 'type' => 'stdlib',
74
+ }
75
+
76
+ # polyfill of singleton module
77
+ def self.instance: () -> instance
78
+
79
+ def has?: (Config::gem_entry) -> bool
80
+
81
+ def versions: (Config::gem_entry) -> Array[String]
82
+
83
+ def install: (dest: Pathname, config_entry: Config::gem_entry, stdout: CLI::_IO) -> void
84
+
85
+ def to_lockfile: () -> source_entry
86
+
87
+ private
88
+
89
+ def gem_dir: (Config::gem_entry) -> Pathname
90
+ end
91
+
92
+ # sig/ directory
93
+ class Rubygems
94
+ type source_entry = {
95
+ 'type' => 'rubygems',
96
+ }
97
+
98
+ # polyfill of singleton module
99
+ def self.instance: () -> instance
100
+
101
+ def has?: (Config::gem_entry) -> boolish
102
+ def versions: (Config::gem_entry) -> Array[String]
103
+ def install: (dest: Pathname, config_entry: Config::gem_entry, stdout: CLI::_IO) -> void
104
+ def to_lockfile: () -> source_entry
105
+
106
+ private
107
+
108
+ def gem_sig_path: (Config::gem_entry) -> [Gem::Specification, Pathname]?
109
+ end
110
+ end
111
+ end
112
+ end
@@ -0,0 +1,69 @@
1
+ module RBS
2
+ module Collection
3
+ # This class represent the configration file.
4
+ class Config
5
+ class LockfileGenerator
6
+ attr_reader config: Config
7
+ attr_reader lock: Config?
8
+ attr_reader lock_path: Pathname
9
+ attr_reader gemfile_lock: Bundler::LockfileParser
10
+
11
+ def self.generate: (config_path: Pathname, gemfile_lock_path: Pathname, ?with_lockfile: boolish) -> Config
12
+
13
+ def initialize: (config_path: Pathname, gemfile_lock_path: Pathname, with_lockfile: boolish) -> void
14
+
15
+ def generate: () -> Config
16
+
17
+ private
18
+
19
+ def assign_gem: (gem_name: String, version: String?) -> void
20
+
21
+ def upsert_gem: (gem_entry? old, gem_entry new) -> void
22
+
23
+ def gemfile_lock_gems: () { (untyped) -> void } -> void
24
+
25
+ def remove_ignored_gems!: () -> void
26
+
27
+ def find_source: (gem_name: String) -> untyped
28
+
29
+ def find_best_version: (version: String?, versions: Array[String]) -> Gem::Version
30
+ end
31
+
32
+ PATH: Pathname
33
+
34
+ type gem_entry = {
35
+ 'name' => String,
36
+ 'version' => String?,
37
+ 'ignore' => boolish,
38
+ 'source' => Sources::source_entry?
39
+ }
40
+
41
+ @config_path: Pathname
42
+
43
+ def self.generate_lockfile: (config_path: Pathname, gemfile_lock_path: Pathname, ?with_lockfile: boolish) -> Config
44
+
45
+ def self.from_path: (Pathname path) -> Config
46
+
47
+ def self.lockfile_of: (Pathname config_path) -> Config?
48
+
49
+ def self.to_lockfile_path: (Pathname config_path) -> Pathname
50
+
51
+ # config_path is necessary to resolve relative repo_path
52
+ def initialize: (untyped data, config_path: Pathname) -> void
53
+
54
+ def add_gem: (untyped gem) -> untyped
55
+
56
+ def gem: (String gem_name) -> untyped
57
+
58
+ def repo_path: () -> Pathname
59
+
60
+ def sources: () -> Array[Sources::_Source]
61
+
62
+ def dump_to: (Pathname) -> void
63
+
64
+ def gems: () -> Array[untyped]
65
+
66
+ def check_rbs_availability!: () -> void
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,15 @@
1
+ module RBS
2
+ module Collection
3
+ class Installer
4
+ attr_reader lockfile: Config
5
+ attr_reader stdout: CLI::_IO
6
+
7
+ def initialize: (lockfile_path: Pathname, ?stdout: CLI::_IO) -> void
8
+ def install_from_lockfile: () -> void
9
+
10
+ private
11
+
12
+ def source_for: (Config::gem_entry) -> Sources::_Source
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,4 @@
1
+ module RBS
2
+ module Collection
3
+ end
4
+ end
@@ -78,6 +78,9 @@ module RBS
78
78
  def add: (path: Pathname) -> void
79
79
  | (library: String, version: String?) -> void
80
80
 
81
+ # Add repository path and libraries via rbs_collection.lock.yaml.
82
+ def add_collection: (Collection::Config collection_config) -> void
83
+
81
84
  # This is helper function to test if RBS for a library is available or not.
82
85
  #
83
86
  def has_library?: (library: String, version: String?) -> bool
data/sig/polyfill.rbs CHANGED
@@ -1,6 +1,3 @@
1
- module Kernel
2
- end
3
-
4
1
  module Gem
5
2
  class Specification
6
3
  attr_reader version (): Version
@@ -16,3 +13,15 @@ module Enumerable[unchecked out Elem]
16
13
  | [U] () { (Elem) -> U } -> Array[U]
17
14
  | ...
18
15
  end
16
+
17
+ module Bundler
18
+ class LockfileParser
19
+ def initialize: (String) -> void
20
+ def specs: () -> Array[LazySpecification]
21
+ end
22
+
23
+ class LazySpecification
24
+ def name: () -> String
25
+ def version: () -> String
26
+ end
27
+ end
data/sig/repository.rbs CHANGED
@@ -57,6 +57,10 @@ module RBS
57
57
 
58
58
  attr_reader gems: Hash[String, GemRBS]
59
59
 
60
+ def self.default: () -> instance
61
+
62
+ def self.find_best_version: (Gem::Version? version, Array[Gem::Version] candidates) -> Gem::Version
63
+
60
64
  # An optional keyword argument `no_stdlib` is to skip adding directory for stdlib classes.
61
65
  # Passing truthy value will skip loading stdlib. (You can add the stdlib root by yourself.)
62
66
  #
@@ -0,0 +1,406 @@
1
+ # The objspace library extends the ObjectSpace module and adds several methods
2
+ # to get internal statistic information about object/memory management.
3
+ #
4
+ # You need to `require 'objspace'` to use this extension module.
5
+ #
6
+ # Generally, you *SHOULD NOT* use this library if you do not know about the MRI
7
+ # implementation. Mainly, this library is for (memory) profiler developers and
8
+ # MRI developers who need to know about MRI memory usage.
9
+ # The ObjectSpace module contains a number of routines that interact with the
10
+ # garbage collection facility and allow you to traverse all living objects with
11
+ # an iterator.
12
+ #
13
+ # ObjectSpace also provides support for object finalizers, procs that will be
14
+ # called when a specific object is about to be destroyed by garbage collection.
15
+ # See the documentation for `ObjectSpace.define_finalizer` for important
16
+ # information on how to use this method correctly.
17
+ #
18
+ # a = "A"
19
+ # b = "B"
20
+ #
21
+ # ObjectSpace.define_finalizer(a, proc {|id| puts "Finalizer one on #{id}" })
22
+ # ObjectSpace.define_finalizer(b, proc {|id| puts "Finalizer two on #{id}" })
23
+ #
24
+ # a = nil
25
+ # b = nil
26
+ #
27
+ # *produces:*
28
+ #
29
+ # Finalizer two on 537763470
30
+ # Finalizer one on 537763480
31
+ module ObjectSpace
32
+ # Returns the class for the given `object`.
33
+ #
34
+ # class A
35
+ # def foo
36
+ # ObjectSpace::trace_object_allocations do
37
+ # obj = Object.new
38
+ # p "#{ObjectSpace::allocation_class_path(obj)}"
39
+ # end
40
+ # end
41
+ # end
42
+ #
43
+ # A.new.foo #=> "Class"
44
+ #
45
+ # See ::trace_object_allocations for more information and examples.
46
+ #
47
+ def self.allocation_class_path: (untyped) -> String
48
+
49
+ # Returns garbage collector generation for the given `object`.
50
+ #
51
+ # class B
52
+ # include ObjectSpace
53
+ #
54
+ # def foo
55
+ # trace_object_allocations do
56
+ # obj = Object.new
57
+ # p "Generation is #{allocation_generation(obj)}"
58
+ # end
59
+ # end
60
+ # end
61
+ #
62
+ # B.new.foo #=> "Generation is 3"
63
+ #
64
+ # See ::trace_object_allocations for more information and examples.
65
+ #
66
+ def self.allocation_generation: (untyped) -> (Integer | nil)
67
+
68
+ # Returns the method identifier for the given `object`.
69
+ #
70
+ # class A
71
+ # include ObjectSpace
72
+ #
73
+ # def foo
74
+ # trace_object_allocations do
75
+ # obj = Object.new
76
+ # p "#{allocation_class_path(obj)}##{allocation_method_id(obj)}"
77
+ # end
78
+ # end
79
+ # end
80
+ #
81
+ # A.new.foo #=> "Class#new"
82
+ #
83
+ # See ::trace_object_allocations for more information and examples.
84
+ #
85
+ def self.allocation_method_id: (untyped) -> Symbol
86
+
87
+ # Returns the source file origin from the given `object`.
88
+ #
89
+ # See ::trace_object_allocations for more information and examples.
90
+ #
91
+ def self.allocation_sourcefile: (untyped) -> String
92
+
93
+ # Returns the original line from source for from the given `object`.
94
+ #
95
+ # See ::trace_object_allocations for more information and examples.
96
+ #
97
+ def self.allocation_sourceline: (untyped) -> Integer
98
+
99
+ # Counts objects for each `T_IMEMO` type.
100
+ #
101
+ # This method is only for MRI developers interested in performance and memory
102
+ # usage of Ruby programs.
103
+ #
104
+ # It returns a hash as:
105
+ #
106
+ # {:imemo_ifunc=>8,
107
+ # :imemo_svar=>7,
108
+ # :imemo_cref=>509,
109
+ # :imemo_memo=>1,
110
+ # :imemo_throw_data=>1}
111
+ #
112
+ # If the optional argument, result_hash, is given, it is overwritten and
113
+ # returned. This is intended to avoid probe effect.
114
+ #
115
+ # The contents of the returned hash is implementation specific and may change in
116
+ # the future.
117
+ #
118
+ # In this version, keys are symbol objects.
119
+ #
120
+ # This method is only expected to work with C Ruby.
121
+ #
122
+ def self.count_imemo_objects: (?Hash[Symbol, Integer] result_hash) -> Hash[Symbol, Integer]
123
+
124
+ # Counts nodes for each node type.
125
+ #
126
+ # This method is only for MRI developers interested in performance and memory
127
+ # usage of Ruby programs.
128
+ #
129
+ # It returns a hash as:
130
+ #
131
+ # {:NODE_METHOD=>2027, :NODE_FBODY=>1927, :NODE_CFUNC=>1798, ...}
132
+ #
133
+ # If the optional argument, result_hash, is given, it is overwritten and
134
+ # returned. This is intended to avoid probe effect.
135
+ #
136
+ # Note: The contents of the returned hash is implementation defined. It may be
137
+ # changed in future.
138
+ #
139
+ # This method is only expected to work with C Ruby.
140
+ #
141
+ def self.count_nodes: (?Hash[Symbol, Integer] result_hash) -> Hash[Symbol, Integer]
142
+
143
+ # Counts objects size (in bytes) for each type.
144
+ #
145
+ # Note that this information is incomplete. You need to deal with this
146
+ # information as only a **HINT**. Especially, total size of T_DATA may be
147
+ # wrong.
148
+ #
149
+ # It returns a hash as:
150
+ # {:TOTAL=>1461154, :T_CLASS=>158280, :T_MODULE=>20672, :T_STRING=>527249, ...}
151
+ #
152
+ # If the optional argument, result_hash, is given, it is overwritten and
153
+ # returned. This is intended to avoid probe effect.
154
+ #
155
+ # The contents of the returned hash is implementation defined. It may be changed
156
+ # in future.
157
+ #
158
+ # This method is only expected to work with C Ruby.
159
+ #
160
+ def self.count_objects_size: (?Hash[Symbol, Integer] result_hash) -> Hash[Symbol, Integer]
161
+
162
+ # Counts symbols for each Symbol type.
163
+ #
164
+ # This method is only for MRI developers interested in performance and memory
165
+ # usage of Ruby programs.
166
+ #
167
+ # If the optional argument, result_hash, is given, it is overwritten and
168
+ # returned. This is intended to avoid probe effect.
169
+ #
170
+ # Note: The contents of the returned hash is implementation defined. It may be
171
+ # changed in future.
172
+ #
173
+ # This method is only expected to work with C Ruby.
174
+ #
175
+ # On this version of MRI, they have 3 types of Symbols (and 1 total counts).
176
+ #
177
+ # * mortal_dynamic_symbol: GC target symbols (collected by GC)
178
+ # * immortal_dynamic_symbol: Immortal symbols promoted from dynamic symbols (do not collected by GC)
179
+ # * immortal_static_symbol: Immortal symbols (do not collected by GC)
180
+ # * immortal_symbol: total immortal symbols (immortal_dynamic_symbol+immortal_static_symbol)
181
+ #
182
+ def self.count_symbols: (?Hash[Symbol, Integer] result_hash) -> Hash[Symbol, Integer]
183
+
184
+ # Counts objects for each `T_DATA` type.
185
+ #
186
+ # This method is only for MRI developers interested in performance and memory
187
+ # usage of Ruby programs.
188
+ #
189
+ # It returns a hash as:
190
+ #
191
+ # {RubyVM::InstructionSequence=>504, :parser=>5, :barrier=>6,
192
+ # :mutex=>6, Proc=>60, RubyVM::Env=>57, Mutex=>1, Encoding=>99,
193
+ # ThreadGroup=>1, Binding=>1, Thread=>1, RubyVM=>1, :iseq=>1,
194
+ # Random=>1, ARGF.class=>1, Data=>1, :autoload=>3, Time=>2}
195
+ # # T_DATA objects existing at startup on r32276.
196
+ #
197
+ # If the optional argument, result_hash, is given, it is overwritten and
198
+ # returned. This is intended to avoid probe effect.
199
+ #
200
+ # The contents of the returned hash is implementation specific and may change in
201
+ # the future.
202
+ #
203
+ # In this version, keys are Class object or Symbol object.
204
+ #
205
+ # If object is kind of normal (accessible) object, the key is Class object. If
206
+ # object is not a kind of normal (internal) object, the key is symbol name,
207
+ # registered by rb_data_type_struct.
208
+ #
209
+ # This method is only expected to work with C Ruby.
210
+ #
211
+ def self.count_tdata_objects: (?Hash[untyped, Integer] result_hash) -> Hash[untyped, Integer]
212
+
213
+ def self.dump: (untyped obj, ?output: Symbol) -> (String | File | nil)
214
+
215
+ def self.dump_all: (?since: (Integer|nil), ?full: boolish, ?output: Symbol) -> (String | File | nil)
216
+
217
+ # MRI specific feature
218
+ # : Return internal class of obj.
219
+ #
220
+ # obj can be an instance of InternalObjectWrapper.
221
+ #
222
+ # Note that you should not use this method in your application.
223
+ #
224
+ def self.internal_class_of: (untyped) -> Class
225
+
226
+ # MRI specific feature
227
+ # : Return internal super class of cls (Class or Module).
228
+ #
229
+ # obj can be an instance of InternalObjectWrapper.
230
+ #
231
+ # Note that you should not use this method in your application.
232
+ #
233
+ def self.internal_super_of: (untyped) -> untyped
234
+
235
+ # Return consuming memory size of obj in bytes.
236
+ #
237
+ # Note that the return size is incomplete. You need to deal with this
238
+ # information as only a **HINT**. Especially, the size of `T_DATA` may not be
239
+ # correct.
240
+ #
241
+ # This method is only expected to work with C Ruby.
242
+ #
243
+ # From Ruby 2.2, memsize_of(obj) returns a memory size includes sizeof(RVALUE).
244
+ #
245
+ def self.memsize_of: (untyped) -> Integer
246
+
247
+ # Return consuming memory size of all living objects in bytes.
248
+ #
249
+ # If `klass` (should be Class object) is given, return the total memory size of
250
+ # instances of the given class.
251
+ #
252
+ # Note that the returned size is incomplete. You need to deal with this
253
+ # information as only a **HINT**. Especially, the size of `T_DATA` may not be
254
+ # correct.
255
+ #
256
+ # Note that this method does **NOT** return total malloc'ed memory size.
257
+ #
258
+ # This method can be defined by the following Ruby code:
259
+ #
260
+ # def memsize_of_all klass = false
261
+ # total = 0
262
+ # ObjectSpace.each_object{|e|
263
+ # total += ObjectSpace.memsize_of(e) if klass == false || e.kind_of?(klass)
264
+ # }
265
+ # total
266
+ # end
267
+ #
268
+ # This method is only expected to work with C Ruby.
269
+ #
270
+ def self.memsize_of_all: (?Class) -> Integer
271
+
272
+ # MRI specific feature
273
+ # : Return all reachable objects from `obj'.
274
+ #
275
+ #
276
+ # This method returns all reachable objects from `obj'.
277
+ #
278
+ # If `obj' has two or more references to the same object `x', then returned
279
+ # array only includes one `x' object.
280
+ #
281
+ # If `obj' is a non-markable (non-heap management) object such as true, false,
282
+ # nil, symbols and Fixnums (and Flonum) then it simply returns nil.
283
+ #
284
+ # If `obj' has references to an internal object, then it returns instances of
285
+ # ObjectSpace::InternalObjectWrapper class. This object contains a reference to
286
+ # an internal object and you can check the type of internal object with `type'
287
+ # method.
288
+ #
289
+ # If `obj' is instance of ObjectSpace::InternalObjectWrapper class, then this
290
+ # method returns all reachable object from an internal object, which is pointed
291
+ # by `obj'.
292
+ #
293
+ # With this method, you can find memory leaks.
294
+ #
295
+ # This method is only expected to work except with C Ruby.
296
+ #
297
+ # Example:
298
+ # ObjectSpace.reachable_objects_from(['a', 'b', 'c'])
299
+ # #=> [Array, 'a', 'b', 'c']
300
+ #
301
+ # ObjectSpace.reachable_objects_from(['a', 'a', 'a'])
302
+ # #=> [Array, 'a', 'a', 'a'] # all 'a' strings have different object id
303
+ #
304
+ # ObjectSpace.reachable_objects_from([v = 'a', v, v])
305
+ # #=> [Array, 'a']
306
+ #
307
+ # ObjectSpace.reachable_objects_from(1)
308
+ # #=> nil # 1 is not markable (heap managed) object
309
+ #
310
+ def self.reachable_objects_from: (untyped) -> ([ untyped ] | nil)
311
+
312
+ # MRI specific feature
313
+ # : Return all reachable objects from root.
314
+ #
315
+ #
316
+ def self.reachable_objects_from_root: () -> Hash[String, untyped]
317
+
318
+ # Starts tracing object allocations from the ObjectSpace extension module.
319
+ #
320
+ # For example:
321
+ #
322
+ # require 'objspace'
323
+ #
324
+ # class C
325
+ # include ObjectSpace
326
+ #
327
+ # def foo
328
+ # trace_object_allocations do
329
+ # obj = Object.new
330
+ # p "#{allocation_sourcefile(obj)}:#{allocation_sourceline(obj)}"
331
+ # end
332
+ # end
333
+ # end
334
+ #
335
+ # C.new.foo #=> "objtrace.rb:8"
336
+ #
337
+ # This example has included the ObjectSpace module to make it easier to read,
338
+ # but you can also use the ::trace_object_allocations notation (recommended).
339
+ #
340
+ # Note that this feature introduces a huge performance decrease and huge memory
341
+ # consumption.
342
+ #
343
+ def self.trace_object_allocations: () { (untyped) -> untyped } -> untyped
344
+
345
+ # Clear recorded tracing information.
346
+ #
347
+ def self.trace_object_allocations_clear: () -> void
348
+
349
+ def self.trace_object_allocations_debug_start: () -> void
350
+
351
+ # Starts tracing object allocations.
352
+ #
353
+ def self.trace_object_allocations_start: () -> void
354
+
355
+ # Stop tracing object allocations.
356
+ #
357
+ # Note that if ::trace_object_allocations_start is called n-times, then tracing
358
+ # will stop after calling ::trace_object_allocations_stop n-times.
359
+ #
360
+ def self.trace_object_allocations_stop: () -> void
361
+
362
+ private
363
+
364
+ # Dump the contents of a ruby object as JSON.
365
+ #
366
+ # This method is only expected to work with C Ruby. This is an experimental
367
+ # method and is subject to change. In particular, the function signature and
368
+ # output format are not guaranteed to be compatible in future versions of ruby.
369
+ #
370
+ def dump: (untyped obj, ?output: Symbol) -> (String|File|nil)
371
+
372
+ # Dump the contents of the ruby heap as JSON.
373
+ #
374
+ # *since* must be a non-negative integer or `nil`.
375
+ #
376
+ # If *since* is a positive integer, only objects of that generation and newer
377
+ # generations are dumped. The current generation can be accessed using
378
+ # GC::count.
379
+ #
380
+ # Objects that were allocated without object allocation tracing enabled are
381
+ # ignored. See ::trace_object_allocations for more information and examples.
382
+ #
383
+ # If *since* is omitted or is `nil`, all objects are dumped.
384
+ #
385
+ # This method is only expected to work with C Ruby. This is an experimental
386
+ # method and is subject to change. In particular, the function signature and
387
+ # output format are not guaranteed to be compatible in future versions of ruby.
388
+ #
389
+ def dump_all: (?since: (Integer|nil), ?full: boolish, ?output: Symbol) -> (String|File|nil)
390
+
391
+ def memsize_of: (untyped) -> Integer
392
+
393
+ def memsize_of_all: (?class) -> Integer
394
+
395
+ def reachable_objects_from: (untyped) -> ([ untyped ] | nil)
396
+
397
+ def reachable_objects_from_root: () -> Hash[String, untyped]
398
+
399
+ def trace_object_allocations_clear: () -> void
400
+
401
+ def trace_object_allocations_debug_start: () -> void
402
+
403
+ def trace_object_allocations_start: () -> void
404
+
405
+ def trace_object_allocations_stop: () -> void
406
+ end