rbs 0.12.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +10 -10
  3. data/.gitignore +0 -1
  4. data/CHANGELOG.md +24 -0
  5. data/Gemfile +3 -0
  6. data/README.md +8 -2
  7. data/Rakefile +9 -4
  8. data/Steepfile +1 -0
  9. data/bin/annotate-with-rdoc +1 -1
  10. data/bin/setup +0 -2
  11. data/bin/test_runner.rb +3 -6
  12. data/docs/CONTRIBUTING.md +1 -0
  13. data/goodcheck.yml +22 -5
  14. data/lib/rbs/ast/comment.rb +1 -1
  15. data/lib/rbs/cli.rb +12 -4
  16. data/lib/rbs/constant.rb +1 -1
  17. data/lib/rbs/constant_table.rb +9 -8
  18. data/lib/rbs/definition_builder.rb +4 -5
  19. data/lib/rbs/environment.rb +5 -1
  20. data/lib/rbs/environment_loader.rb +12 -12
  21. data/lib/rbs/namespace.rb +1 -1
  22. data/lib/rbs/parser.rb +3146 -0
  23. data/lib/rbs/parser.y +7 -2
  24. data/lib/rbs/test/setup_helper.rb +4 -4
  25. data/lib/rbs/test/type_check.rb +2 -2
  26. data/lib/rbs/type_name.rb +1 -1
  27. data/lib/rbs/variance_calculator.rb +2 -2
  28. data/lib/rbs/version.rb +1 -1
  29. data/lib/rbs/writer.rb +25 -15
  30. data/sig/constant.rbs +21 -0
  31. data/sig/constant_table.rbs +30 -0
  32. data/sig/declarations.rbs +1 -1
  33. data/sig/definition.rbs +1 -1
  34. data/sig/definition_builder.rbs +4 -5
  35. data/sig/environment_loader.rbs +54 -0
  36. data/sig/namespace.rbs +3 -3
  37. data/sig/parser.rbs +25 -0
  38. data/sig/substitution.rbs +3 -3
  39. data/sig/typename.rbs +1 -1
  40. data/sig/types.rbs +1 -1
  41. data/sig/version.rbs +3 -0
  42. data/sig/writer.rbs +40 -0
  43. data/stdlib/benchmark/benchmark.rbs +2 -2
  44. data/stdlib/builtin/basic_object.rbs +54 -54
  45. data/stdlib/builtin/binding.rbs +42 -42
  46. data/stdlib/builtin/class.rbs +33 -33
  47. data/stdlib/builtin/complex.rbs +90 -90
  48. data/stdlib/builtin/encoding.rbs +33 -33
  49. data/stdlib/builtin/enumerable.rbs +32 -32
  50. data/stdlib/builtin/enumerator.rbs +35 -35
  51. data/stdlib/builtin/errors.rbs +1 -1
  52. data/stdlib/builtin/exception.rbs +50 -50
  53. data/stdlib/builtin/false_class.rbs +6 -6
  54. data/stdlib/builtin/fiber.rbs +14 -14
  55. data/stdlib/builtin/fiber_error.rbs +1 -1
  56. data/stdlib/builtin/float.rbs +161 -161
  57. data/stdlib/builtin/gc.rbs +1 -1
  58. data/stdlib/builtin/io.rbs +83 -83
  59. data/stdlib/builtin/kernel.rbs +70 -68
  60. data/stdlib/builtin/match_data.rbs +1 -1
  61. data/stdlib/builtin/method.rbs +19 -19
  62. data/stdlib/builtin/nil_class.rbs +20 -20
  63. data/stdlib/builtin/numeric.rbs +101 -101
  64. data/stdlib/builtin/object.rbs +172 -172
  65. data/stdlib/builtin/proc.rbs +91 -91
  66. data/stdlib/builtin/range.rbs +2 -4
  67. data/stdlib/builtin/rational.rbs +83 -83
  68. data/stdlib/builtin/signal.rbs +7 -7
  69. data/stdlib/builtin/string.rbs +4 -4
  70. data/stdlib/builtin/string_io.rbs +1 -1
  71. data/stdlib/builtin/thread.rbs +185 -185
  72. data/stdlib/builtin/thread_group.rbs +2 -2
  73. data/stdlib/builtin/true_class.rbs +9 -9
  74. data/stdlib/builtin/warning.rbs +1 -1
  75. data/stdlib/date/date.rbs +2 -2
  76. data/stdlib/find/find.rbs +10 -10
  77. data/stdlib/pathname/pathname.rbs +2 -0
  78. data/stdlib/pty/pty.rbs +5 -29
  79. data/stdlib/tmpdir/tmpdir.rbs +12 -12
  80. data/stdlib/uri/generic.rbs +1 -1
  81. data/stdlib/uri/http.rbs +158 -0
  82. data/stdlib/uri/https.rbs +108 -0
  83. data/stdlib/uri/ldap.rbs +224 -0
  84. data/stdlib/uri/ldaps.rbs +108 -0
  85. data/steep/Gemfile.lock +13 -17
  86. metadata +12 -3
@@ -0,0 +1,3 @@
1
+ module RBS
2
+ VERSION: String
3
+ end
@@ -0,0 +1,40 @@
1
+ module RBS
2
+ class Writer
3
+ attr_reader out: IO
4
+ attr_reader indentation: Array[String]
5
+
6
+ def initialize: (out: IO) -> void
7
+
8
+ def indent: (?Integer size) { () -> void } -> void
9
+
10
+ def prefix: () -> String
11
+
12
+ def puts: (?String) -> void
13
+
14
+ def write_annotation: (Array[AST::Annotation]) -> void
15
+
16
+ def write_comment: (AST::Comment?) -> void
17
+
18
+ def write: (Array[AST::Declarations::t]) -> void
19
+
20
+ def write_decl: (AST::Declarations::t) -> void
21
+
22
+ def write_member: (AST::Declarations::Module::member) -> void
23
+
24
+ def name_and_params: (TypeName, AST::Declarations::ModuleTypeParams) -> String?
25
+
26
+ def name_and_args: (TypeName, Array[Types::t]) -> String?
27
+
28
+ def method_name: (Symbol) -> String
29
+
30
+ def write_def: (AST::Members::MethodDefinition) -> void
31
+
32
+ def attribute: (:reader | :writer | :accessor, AST::Members::Attribute) -> void
33
+
34
+ interface _Located
35
+ def location: () -> Location?
36
+ end
37
+
38
+ def preserve_empty_line: (_Located?, _Located) -> void
39
+ end
40
+ end
@@ -53,9 +53,9 @@
53
53
  # times: 1.000000 0.000000 1.000000 ( 1.003611)
54
54
  # upto: 1.030000 0.000000 1.030000 ( 1.028098)
55
55
  #
56
- # * The times for some benchmarks depend on the order in which items are run.
56
+ # * The times for some benchmarks depend on the order in which items are run.
57
57
  # These differences are due to the cost of memory allocation and garbage
58
- # collection. To avoid these discrepancies, the #bmbm method is provided.
58
+ # collection. To avoid these discrepancies, the #bmbm method is provided.
59
59
  # For example, to compare ways to sort an array of floats:
60
60
  #
61
61
  # require 'benchmark'
@@ -1,108 +1,108 @@
1
1
  # BasicObject is the parent class of all classes in Ruby. It's an explicit
2
2
  # blank class.
3
- #
3
+ #
4
4
  # BasicObject can be used for creating object hierarchies independent of Ruby's
5
5
  # object hierarchy, proxy objects like the Delegator class, or other uses where
6
6
  # namespace pollution from Ruby's methods and classes must be avoided.
7
- #
7
+ #
8
8
  # To avoid polluting BasicObject for other users an appropriately named subclass
9
9
  # of BasicObject should be created instead of directly modifying BasicObject:
10
- #
10
+ #
11
11
  # class MyObjectSystem < BasicObject
12
12
  # end
13
- #
13
+ #
14
14
  # BasicObject does not include Kernel (for methods like `puts`) and BasicObject
15
15
  # is outside of the namespace of the standard library so common classes will not
16
16
  # be found without using a full class path.
17
- #
17
+ #
18
18
  # A variety of strategies can be used to provide useful portions of the standard
19
19
  # library to subclasses of BasicObject. A subclass could `include Kernel` to
20
20
  # obtain `puts`, `exit`, etc. A custom Kernel-like module could be created and
21
21
  # included or delegation can be used via #method_missing:
22
- #
22
+ #
23
23
  # class MyObjectSystem < BasicObject
24
24
  # DELEGATE = [:puts, :p]
25
- #
25
+ #
26
26
  # def method_missing(name, *args, &block)
27
27
  # super unless DELEGATE.include? name
28
28
  # ::Kernel.send(name, *args, &block)
29
29
  # end
30
- #
30
+ #
31
31
  # def respond_to_missing?(name, include_private = false)
32
32
  # DELEGATE.include?(name) or super
33
33
  # end
34
34
  # end
35
- #
35
+ #
36
36
  # Access to classes and modules from the Ruby standard library can be obtained
37
37
  # in a BasicObject subclass by referencing the desired constant from the root
38
38
  # like `::File` or `::Enumerator`. Like #method_missing, #const_missing can be
39
39
  # used to delegate constant lookup to `Object`:
40
- #
40
+ #
41
41
  # class MyObjectSystem < BasicObject
42
42
  # def self.const_missing(name)
43
43
  # ::Object.const_get(name)
44
44
  # end
45
45
  # end
46
- #
46
+ #
47
47
  class BasicObject
48
48
  # Boolean negate.
49
- #
49
+ #
50
50
  def !: () -> bool
51
51
 
52
52
  # Returns true if two objects are not-equal, otherwise false.
53
- #
53
+ #
54
54
  def !=: (untyped other) -> bool
55
55
 
56
56
  # Equality --- At the `Object` level, `==` returns `true` only if `obj` and
57
57
  # `other` are the same object. Typically, this method is overridden in
58
58
  # descendant classes to provide class-specific meaning.
59
- #
59
+ #
60
60
  # Unlike `==`, the `equal?` method should never be overridden by subclasses as
61
61
  # it is used to determine object identity (that is, `a.equal?(b)` if and only if
62
62
  # `a` is the same object as `b`):
63
- #
63
+ #
64
64
  # obj = "a"
65
65
  # other = obj.dup
66
- #
66
+ #
67
67
  # obj == other #=> true
68
68
  # obj.equal? other #=> false
69
69
  # obj.equal? obj #=> true
70
- #
70
+ #
71
71
  # The `eql?` method returns `true` if `obj` and `other` refer to the same hash
72
72
  # key. This is used by Hash to test members for equality. For objects of class
73
73
  # `Object`, `eql?` is synonymous with `==`. Subclasses normally continue this
74
74
  # tradition by aliasing `eql?` to their overridden `==` method, but there are
75
75
  # exceptions. `Numeric` types, for example, perform type conversion across
76
76
  # `==`, but not across `eql?`, so:
77
- #
77
+ #
78
78
  # 1 == 1.0 #=> true
79
79
  # 1.eql? 1.0 #=> false
80
- #
80
+ #
81
81
  def ==: (untyped other) -> bool
82
82
 
83
83
  # Returns an integer identifier for `obj`.
84
- #
84
+ #
85
85
  # The same number will be returned on all calls to `object_id` for a given
86
86
  # object, and no two active objects will share an id.
87
- #
87
+ #
88
88
  # Note: that some objects of builtin classes are reused for optimization. This
89
89
  # is the case for immediate values and frozen string literals.
90
- #
90
+ #
91
91
  # Immediate values are not passed by reference but are passed by value: `nil`,
92
92
  # `true`, `false`, Fixnums, Symbols, and some Floats.
93
- #
93
+ #
94
94
  # Object.new.object_id == Object.new.object_id # => false
95
95
  # (21 * 2).object_id == (21 * 2).object_id # => true
96
96
  # "hello".object_id == "hello".object_id # => false
97
97
  # "hi".freeze.object_id == "hi".freeze.object_id # => true
98
- #
98
+ #
99
99
  def __id__: () -> Integer
100
100
 
101
101
  # Invokes the method identified by *symbol*, passing it any arguments specified.
102
102
  # You can use `__send__` if the name `send` clashes with an existing method in
103
103
  # *obj*. When the method is identified by a string, the string is converted to a
104
104
  # symbol.
105
- #
105
+ #
106
106
  # class Klass
107
107
  # def hello(*args)
108
108
  # "Hello " + args.join(' ')
@@ -110,48 +110,48 @@ class BasicObject
110
110
  # end
111
111
  # k = Klass.new
112
112
  # k.send :hello, "gentle", "readers" #=> "Hello gentle readers"
113
- #
113
+ #
114
114
  def __send__: (String | Symbol arg0, *untyped args) -> untyped
115
115
 
116
116
  # Equality --- At the `Object` level, `==` returns `true` only if `obj` and
117
117
  # `other` are the same object. Typically, this method is overridden in
118
118
  # descendant classes to provide class-specific meaning.
119
- #
119
+ #
120
120
  # Unlike `==`, the `equal?` method should never be overridden by subclasses as
121
121
  # it is used to determine object identity (that is, `a.equal?(b)` if and only if
122
122
  # `a` is the same object as `b`):
123
- #
123
+ #
124
124
  # obj = "a"
125
125
  # other = obj.dup
126
- #
126
+ #
127
127
  # obj == other #=> true
128
128
  # obj.equal? other #=> false
129
129
  # obj.equal? obj #=> true
130
- #
130
+ #
131
131
  # The `eql?` method returns `true` if `obj` and `other` refer to the same hash
132
132
  # key. This is used by Hash to test members for equality. For objects of class
133
133
  # `Object`, `eql?` is synonymous with `==`. Subclasses normally continue this
134
134
  # tradition by aliasing `eql?` to their overridden `==` method, but there are
135
135
  # exceptions. `Numeric` types, for example, perform type conversion across
136
136
  # `==`, but not across `eql?`, so:
137
- #
137
+ #
138
138
  # 1 == 1.0 #=> true
139
139
  # 1.eql? 1.0 #=> false
140
- #
140
+ #
141
141
  def equal?: (untyped other) -> bool
142
142
 
143
143
  # Evaluates a string containing Ruby source code, or the given block, within the
144
144
  # context of the receiver (*obj*). In order to set the context, the variable
145
145
  # `self` is set to *obj* while the code is executing, giving the code access to
146
146
  # *obj*'s instance variables and private methods.
147
- #
147
+ #
148
148
  # When `instance_eval` is given a block, *obj* is also passed in as the block's
149
149
  # only argument.
150
- #
150
+ #
151
151
  # When `instance_eval` is given a `String`, the optional second and third
152
152
  # parameters supply a filename and starting line number that are used when
153
153
  # reporting compilation errors.
154
- #
154
+ #
155
155
  # class KlassWithSecret
156
156
  # def initialize
157
157
  # @secret = 99
@@ -165,7 +165,7 @@ class BasicObject
165
165
  # k.instance_eval { @secret } #=> 99
166
166
  # k.instance_eval { the_secret } #=> "Ssssh! The secret is 99."
167
167
  # k.instance_eval {|obj| obj == self } #=> true
168
- #
168
+ #
169
169
  def instance_eval: (String, ?String filename, ?Integer lineno) -> untyped
170
170
  | [U] () { (self) -> U } -> U
171
171
 
@@ -173,7 +173,7 @@ class BasicObject
173
173
  # to set the context, the variable `self` is set to *obj* while the code is
174
174
  # executing, giving the code access to *obj*'s instance variables. Arguments
175
175
  # are passed as block parameters.
176
- #
176
+ #
177
177
  # class KlassWithSecret
178
178
  # def initialize
179
179
  # @secret = 99
@@ -181,11 +181,11 @@ class BasicObject
181
181
  # end
182
182
  # k = KlassWithSecret.new
183
183
  # k.instance_exec(5) {|x| @secret+x } #=> 104
184
- #
184
+ #
185
185
  def instance_exec: [U, V] (*V args) { (*V args) -> U } -> U
186
186
 
187
187
  # Not documented
188
- #
188
+ #
189
189
  def initialize: () -> void
190
190
 
191
191
  private
@@ -199,7 +199,7 @@ class BasicObject
199
199
  # method. The example below creates a class `Roman`, which responds to methods
200
200
  # with names consisting of roman numerals, returning the corresponding integer
201
201
  # values.
202
- #
202
+ #
203
203
  # class Roman
204
204
  # def roman_to_int(str)
205
205
  # # ...
@@ -209,16 +209,16 @@ class BasicObject
209
209
  # roman_to_int(str)
210
210
  # end
211
211
  # end
212
- #
212
+ #
213
213
  # r = Roman.new
214
214
  # r.iv #=> 4
215
215
  # r.xxiii #=> 23
216
216
  # r.mm #=> 2000
217
- #
217
+ #
218
218
  def method_missing: (Symbol, *untyped) -> untyped
219
219
 
220
220
  # Invoked as a callback whenever a singleton method is added to the receiver.
221
- #
221
+ #
222
222
  # module Chatty
223
223
  # def Chatty.singleton_method_added(id)
224
224
  # puts "Adding #{id.id2name}"
@@ -227,18 +227,18 @@ class BasicObject
227
227
  # def two() end
228
228
  # def Chatty.three() end
229
229
  # end
230
- #
230
+ #
231
231
  # *produces:*
232
- #
232
+ #
233
233
  # Adding singleton_method_added
234
234
  # Adding one
235
235
  # Adding three
236
- #
236
+ #
237
237
  def singleton_method_added: (Symbol) -> void
238
238
 
239
239
  # Invoked as a callback whenever a singleton method is removed from the
240
240
  # receiver.
241
- #
241
+ #
242
242
  # module Chatty
243
243
  # def Chatty.singleton_method_removed(id)
244
244
  # puts "Removing #{id.id2name}"
@@ -251,17 +251,17 @@ class BasicObject
251
251
  # remove_method :one
252
252
  # end
253
253
  # end
254
- #
254
+ #
255
255
  # *produces:*
256
- #
256
+ #
257
257
  # Removing three
258
258
  # Removing one
259
- #
259
+ #
260
260
  def singleton_method_removed: (Symbol) -> void
261
261
 
262
262
  # Invoked as a callback whenever a singleton method is undefined in the
263
263
  # receiver.
264
- #
264
+ #
265
265
  # module Chatty
266
266
  # def Chatty.singleton_method_undefined(id)
267
267
  # puts "Undefining #{id.id2name}"
@@ -271,10 +271,10 @@ class BasicObject
271
271
  # undef_method(:one)
272
272
  # end
273
273
  # end
274
- #
274
+ #
275
275
  # *produces:*
276
- #
276
+ #
277
277
  # Undefining one
278
- #
278
+ #
279
279
  def singleton_method_undefined: (Symbol) -> void
280
280
  end
@@ -4,10 +4,10 @@
4
4
  # in this context are all retained. Binding objects can be created using
5
5
  # Kernel#binding, and are made available to the callback of
6
6
  # Kernel#set_trace_func and instances of TracePoint.
7
- #
7
+ #
8
8
  # These binding objects can be passed as the second argument of the Kernel#eval
9
9
  # method, establishing an environment for the evaluation.
10
- #
10
+ #
11
11
  # class Demo
12
12
  # def initialize(n)
13
13
  # @secret = n
@@ -16,39 +16,39 @@
16
16
  # binding
17
17
  # end
18
18
  # end
19
- #
19
+ #
20
20
  # k1 = Demo.new(99)
21
21
  # b1 = k1.get_binding
22
22
  # k2 = Demo.new(-3)
23
23
  # b2 = k2.get_binding
24
- #
24
+ #
25
25
  # eval("@secret", b1) #=> 99
26
26
  # eval("@secret", b2) #=> -3
27
27
  # eval("@secret") #=> nil
28
- #
28
+ #
29
29
  # Binding objects have no class-specific methods.
30
- #
30
+ #
31
31
  class Binding
32
32
  public
33
33
 
34
34
  # Evaluates the Ruby expression(s) in *string*, in the *binding*'s context. If
35
35
  # the optional *filename* and *lineno* parameters are present, they will be used
36
36
  # when reporting syntax errors.
37
- #
37
+ #
38
38
  # def get_binding(param)
39
39
  # binding
40
40
  # end
41
41
  # b = get_binding("hello")
42
42
  # b.eval("param") #=> "hello"
43
- #
43
+ #
44
44
  def eval: (String arg0, ?String filename, ?Integer lineno) -> untyped
45
45
 
46
46
  # Opens an IRB session where `binding.irb` is called which allows for
47
47
  # interactive debugging. You can call any methods or variables available in the
48
48
  # current scope, and mutate state if you need to.
49
- #
49
+ #
50
50
  # Given a Ruby file called `potato.rb` containing the following code:
51
- #
51
+ #
52
52
  # class Potato
53
53
  # def initialize
54
54
  # @cooked = false
@@ -56,16 +56,16 @@ class Binding
56
56
  # puts "Cooked potato: #{@cooked}"
57
57
  # end
58
58
  # end
59
- #
59
+ #
60
60
  # Potato.new
61
- #
61
+ #
62
62
  # Running `ruby potato.rb` will open an IRB session where `binding.irb` is
63
63
  # called, and you will see the following:
64
- #
64
+ #
65
65
  # $ ruby potato.rb
66
- #
66
+ #
67
67
  # From: potato.rb @ line 4 :
68
- #
68
+ #
69
69
  # 1: class Potato
70
70
  # 2: def initialize
71
71
  # 3: @cooked = false
@@ -75,12 +75,12 @@ class Binding
75
75
  # 7: end
76
76
  # 8:
77
77
  # 9: Potato.new
78
- #
78
+ #
79
79
  # irb(#<Potato:0x00007feea1916670>):001:0>
80
- #
80
+ #
81
81
  # You can type any valid Ruby code and it will be evaluated in the current
82
82
  # context. This allows you to debug without having to run your code repeatedly:
83
- #
83
+ #
84
84
  # irb(#<Potato:0x00007feea1916670>):001:0> @cooked
85
85
  # => false
86
86
  # irb(#<Potato:0x00007feea1916670>):002:0> self.class
@@ -89,89 +89,89 @@ class Binding
89
89
  # => ".../2.5.1/lib/ruby/2.5.0/irb/workspace.rb:85:in `eval'"
90
90
  # irb(#<Potato:0x00007feea1916670>):004:0> @cooked = true
91
91
  # => true
92
- #
92
+ #
93
93
  # You can exit the IRB session with the `exit` command. Note that exiting will
94
94
  # resume execution where `binding.irb` had paused it, as you can see from the
95
95
  # output printed to standard output in this example:
96
- #
96
+ #
97
97
  # irb(#<Potato:0x00007feea1916670>):005:0> exit
98
98
  # Cooked potato: true
99
- #
99
+ #
100
100
  # See IRB@IRB+Usage for more information.
101
- #
101
+ #
102
102
  def irb: () -> void
103
103
 
104
104
  # Returns `true` if a local variable `symbol` exists.
105
- #
105
+ #
106
106
  # def foo
107
107
  # a = 1
108
108
  # binding.local_variable_defined?(:a) #=> true
109
109
  # binding.local_variable_defined?(:b) #=> false
110
110
  # end
111
- #
111
+ #
112
112
  # This method is the short version of the following code:
113
- #
113
+ #
114
114
  # binding.eval("defined?(#{symbol}) == 'local-variable'")
115
- #
115
+ #
116
116
  def local_variable_defined?: (String | Symbol symbol) -> bool
117
117
 
118
118
  # Returns the value of the local variable `symbol`.
119
- #
119
+ #
120
120
  # def foo
121
121
  # a = 1
122
122
  # binding.local_variable_get(:a) #=> 1
123
123
  # binding.local_variable_get(:b) #=> NameError
124
124
  # end
125
- #
125
+ #
126
126
  # This method is the short version of the following code:
127
- #
127
+ #
128
128
  # binding.eval("#{symbol}")
129
- #
129
+ #
130
130
  def local_variable_get: (String | Symbol symbol) -> untyped
131
131
 
132
132
  # Set local variable named `symbol` as `obj`.
133
- #
133
+ #
134
134
  # def foo
135
135
  # a = 1
136
136
  # bind = binding
137
137
  # bind.local_variable_set(:a, 2) # set existing local variable `a'
138
138
  # bind.local_variable_set(:b, 3) # create new local variable `b'
139
139
  # # `b' exists only in binding
140
- #
140
+ #
141
141
  # p bind.local_variable_get(:a) #=> 2
142
142
  # p bind.local_variable_get(:b) #=> 3
143
143
  # p a #=> 2
144
144
  # p b #=> NameError
145
145
  # end
146
- #
146
+ #
147
147
  # This method behaves similarly to the following code:
148
- #
148
+ #
149
149
  # binding.eval("#{symbol} = #{obj}")
150
- #
150
+ #
151
151
  # if `obj` can be dumped in Ruby code.
152
- #
152
+ #
153
153
  def local_variable_set: [U] (String | Symbol symbol, U obj) -> U
154
154
 
155
155
  # Returns the names of the binding's local variables as symbols.
156
- #
156
+ #
157
157
  # def foo
158
158
  # a = 1
159
159
  # 2.times do |n|
160
160
  # binding.local_variables #=> [:a, :n]
161
161
  # end
162
162
  # end
163
- #
163
+ #
164
164
  # This method is the short version of the following code:
165
- #
165
+ #
166
166
  # binding.eval("local_variables")
167
- #
167
+ #
168
168
  def local_variables: () -> Array[Symbol]
169
169
 
170
170
  # Returns the bound receiver of the binding object.
171
- #
171
+ #
172
172
  def receiver: () -> untyped
173
173
 
174
174
  # Returns the Ruby source filename and line number of the binding object.
175
- #
175
+ #
176
176
  def source_location: () -> [ String, Integer ]
177
177
  end