rbs 3.1.3 → 3.2.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 (73) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +0 -6
  3. data/CHANGELOG.md +82 -0
  4. data/Gemfile +0 -6
  5. data/Gemfile.lock +12 -21
  6. data/README.md +1 -1
  7. data/Rakefile +45 -1
  8. data/Steepfile +3 -3
  9. data/core/array.rbs +0 -8
  10. data/core/binding.rbs +7 -69
  11. data/core/builtin.rbs +33 -8
  12. data/core/constants.rbs +13 -5
  13. data/core/dir.rbs +25 -25
  14. data/core/errno.rbs +474 -590
  15. data/core/exception.rbs +1 -1
  16. data/core/global_variables.rbs +27 -27
  17. data/core/io.rbs +163 -172
  18. data/core/kernel.rbs +58 -38
  19. data/core/module.rbs +34 -32
  20. data/core/object.rbs +3 -7
  21. data/core/string_io.rbs +9 -0
  22. data/core/thread.rbs +25 -1
  23. data/core/time.rbs +3 -3
  24. data/core/warning.rbs +3 -1
  25. data/docs/CONTRIBUTING.md +1 -1
  26. data/docs/rbs_by_example.md +16 -35
  27. data/docs/repo.md +1 -1
  28. data/docs/sigs.md +7 -7
  29. data/docs/stdlib.md +2 -3
  30. data/docs/syntax.md +40 -40
  31. data/lib/rbs/cli.rb +15 -4
  32. data/lib/rbs/collection/config/lockfile_generator.rb +6 -2
  33. data/lib/rbs/collection/installer.rb +5 -2
  34. data/lib/rbs/collection/sources/stdlib.rb +5 -1
  35. data/lib/rbs/errors.rb +8 -1
  36. data/lib/rbs/file_finder.rb +1 -1
  37. data/lib/rbs/prototype/rb.rb +64 -6
  38. data/lib/rbs/prototype/rbi.rb +2 -6
  39. data/lib/rbs/prototype/runtime.rb +29 -8
  40. data/lib/rbs/subtractor.rb +17 -0
  41. data/lib/rbs/type_name.rb +4 -4
  42. data/lib/rbs/version.rb +1 -1
  43. data/rbs.gemspec +1 -1
  44. data/schema/decls.json +1 -1
  45. data/sig/errors.rbs +54 -0
  46. data/sig/parser.rbs +2 -2
  47. data/sig/prototype/rb.rbs +9 -1
  48. data/sig/subtractor.rbs +4 -0
  49. data/stdlib/logger/0/logger.rbs +1 -1
  50. data/stdlib/observable/0/observable.rbs +219 -0
  51. data/stdlib/uri/0/common.rbs +24 -0
  52. data/stdlib/zlib/0/buf_error.rbs +79 -0
  53. data/stdlib/zlib/0/data_error.rbs +79 -0
  54. data/stdlib/zlib/0/deflate.rbs +276 -0
  55. data/stdlib/zlib/0/error.rbs +89 -0
  56. data/stdlib/zlib/0/gzip_file/crc_error.rbs +115 -0
  57. data/stdlib/zlib/0/gzip_file/error.rbs +128 -0
  58. data/stdlib/zlib/0/gzip_file/length_error.rbs +115 -0
  59. data/stdlib/zlib/0/gzip_file/no_footer.rbs +114 -0
  60. data/stdlib/zlib/0/gzip_file.rbs +228 -0
  61. data/stdlib/zlib/0/gzip_reader.rbs +362 -0
  62. data/stdlib/zlib/0/gzip_writer.rbs +237 -0
  63. data/stdlib/zlib/0/inflate.rbs +249 -0
  64. data/stdlib/zlib/0/mem_error.rbs +79 -0
  65. data/stdlib/zlib/0/need_dict.rbs +82 -0
  66. data/stdlib/zlib/0/stream_end.rbs +80 -0
  67. data/stdlib/zlib/0/stream_error.rbs +80 -0
  68. data/stdlib/zlib/0/version_error.rbs +80 -0
  69. data/stdlib/zlib/0/zstream.rbs +270 -0
  70. metadata +22 -6
  71. data/stdlib/prime/0/integer-extension.rbs +0 -41
  72. data/stdlib/prime/0/manifest.yaml +0 -2
  73. data/stdlib/prime/0/prime.rbs +0 -372
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3eecea95d764201e888ed754df209a3c948d8f703bc31453f53dcef86690ac35
4
- data.tar.gz: 43d8c75f856ca9d9790b5ef451407dc9a9ea21c8dec48708cc425633f1faaa2a
3
+ metadata.gz: 3785c4b5642259ae2d30d7fc88b188283a43367053a2cf958238f800a1aef7dc
4
+ data.tar.gz: a15b431352b349d6d0d3eb034b0a892bc85502ddd5c1158bd41980baee01760a
5
5
  SHA512:
6
- metadata.gz: 7ae9f227f01d1ffe6ec4a8653eac72a83394300e8674d70694ee31abdc2bea71371d07652c9557e5721a352ecb7b063b9373b8589ab9caa2e1513a71809fb790
7
- data.tar.gz: ae92f774b5f1f1992cb2f6f364205e10e6044e761e68fee7356f1836e352c4f5519d1039fe2ecdd14dc88e70d0f8a276da52775f171def6214f0db9e29a23541
6
+ metadata.gz: fec87dba1128481d962646c4a2cc0d8243cc18971584633c1565d70fc2d8d09c94823b60990c4c6ad9ad3167e8c60421c60bfb5f194c1bcbd5079bff7a454ee5
7
+ data.tar.gz: f5f0ead8e4db8c05b11f9d6bbad2be09f0f3951701c58bbf5ffbe62ec2e5ce149dfe53a82b9f7f3cded1871fb80b78177e19fbce5775368f0907bf5b686c8e74
@@ -17,8 +17,6 @@ jobs:
17
17
  - 3.2-dev-focal
18
18
  - 3.1-dev-focal
19
19
  - 3.0-dev-focal
20
- - 2.7-dev-bionic
21
- - 2.6-bionic
22
20
  job:
23
21
  - test
24
22
  - stdlib_test
@@ -28,10 +26,6 @@ jobs:
28
26
  exclude:
29
27
  - container_tag: master-nightly-focal
30
28
  job: confirm_lexer
31
- - container_tag: 2.6-bionic
32
- job: stdlib_test
33
- - container_tag: 2.7-dev-bionic
34
- job: stdlib_test
35
29
  - container_tag: 3.0-dev-focal
36
30
  job: stdlib_test
37
31
  - container_tag: 3.1-dev-focal
data/CHANGELOG.md CHANGED
@@ -2,6 +2,88 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 3.2.0 (2023-08-22)
6
+
7
+ ### Signature updates
8
+
9
+ * `Binding` ([#1451](https://github.com/ruby/rbs/pull/1451))
10
+ * `Kernel` ([#1445](https://github.com/ruby/rbs/pull/1445), [#1444](https://github.com/ruby/rbs/pull/1444), [#1443](https://github.com/ruby/rbs/pull/1443), [#1441](https://github.com/ruby/rbs/pull/1441), [#1440](https://github.com/ruby/rbs/pull/1440))
11
+ * `Errno` ([#1450](https://github.com/ruby/rbs/pull/1450))
12
+
13
+ ### Library changes
14
+
15
+ #### rbs collection
16
+
17
+ * Fix LockfileGenerator crashes if failed to get deps for locked source ([#1413](https://github.com/ruby/rbs/pull/1413))
18
+
19
+ ## 3.2.0.pre.1 (2023-08-18)
20
+
21
+ ### Signature updates
22
+
23
+ * observable ([#1424](https://github.com/ruby/rbs/pull/1424))
24
+ * uri ([#1371](https://github.com/ruby/rbs/pull/1371))
25
+ * zlib ([#1389](https://github.com/ruby/rbs/pull/1389))
26
+ * `IO` ([#1399](https://github.com/ruby/rbs/pull/1399))
27
+ * `::DATA` ([#1395](https://github.com/ruby/rbs/pull/1395))
28
+ * `$DEBUG` ([#1427](https://github.com/ruby/rbs/pull/1427))
29
+ * `ConditionVariable#wait` ([#1397](https://github.com/ruby/rbs/pull/1397))
30
+ * `Kernel::exit!` ([#1396](https://github.com/ruby/rbs/pull/1396))
31
+ * `Kernel#exec` ([#1368](https://github.com/ruby/rbs/pull/1368))
32
+ * `Kernel#p`, `Kernel#pp` ([#1342](https://github.com/ruby/rbs/pull/1342))
33
+ * `Logger.new` ([#1423](https://github.com/ruby/rbs/pull/1423))
34
+ * `Module` ([#1321](https://github.com/ruby/rbs/pull/1321))
35
+ * `Object#define_singleton_method` ([#1431](https://github.com/ruby/rbs/pull/1431))
36
+ * `Object#enum_for` ([#1327](https://github.com/ruby/rbs/pull/1327))
37
+ * `StringIO#truncate` ([#1425](https://github.com/ruby/rbs/pull/1425))
38
+ * `Thread#raise` ([#1426](https://github.com/ruby/rbs/pull/1426))
39
+ * `Time#round`, `Time#floor`, `Time#ceil` ([#1337](https://github.com/ruby/rbs/pull/1337))
40
+ * Remove `TRUE`, `FALSE`, and `NIL` constants ([#1432](https://github.com/ruby/rbs/pull/1432))
41
+ * Updated builtin.rbs's interfaces ([#1429](https://github.com/ruby/rbs/pull/1429))
42
+ * Convert `| nil` to `?` in global_variables.rbs ([#1430](https://github.com/ruby/rbs/pull/1430))
43
+ * Remove references to the transient heap ([#1374](https://github.com/ruby/rbs/pull/1374))
44
+
45
+ ### Library changes
46
+
47
+ * subtract: Remove RBS file if the subtracted definition is empty ([#1385](https://github.com/ruby/rbs/pull/1385))
48
+ * subtract: Filter redundant access modifiers ([#1384](https://github.com/ruby/rbs/pull/1384))
49
+ * Fix module alias normalizations ([#1393](https://github.com/ruby/rbs/pull/1393))
50
+ * Reduce memory allocation on TypeName#initialize ([#1363](https://github.com/ruby/rbs/pull/1363))
51
+ * Fix a type error in FileFinder ([#1326](https://github.com/ruby/rbs/pull/1326))
52
+ * Add signatures about DetailedMessage ([#1323](https://github.com/ruby/rbs/pull/1323))
53
+ * Make TypeNameResolver more compatible with Ruby ([#1373](https://github.com/ruby/rbs/pull/1373))
54
+ * Drop support of Ruby 2.x ([#1364](https://github.com/ruby/rbs/pull/1364))
55
+ * Print detailed_message on parse command ([#1329](https://github.com/ruby/rbs/pull/1329))
56
+ * Relax rdoc version requirement ([#1333](https://github.com/ruby/rbs/pull/1333))
57
+ * Support keyword argument to #detailed_message ([#1328](https://github.com/ruby/rbs/pull/1328))
58
+
59
+ #### rbs prototype
60
+
61
+ * Avoid to generate anonymous or internal module ([#1421](https://github.com/ruby/rbs/pull/1421))
62
+ * Fix type name for prototype rbi ([#1386](https://github.com/ruby/rbs/pull/1386))
63
+ * Support type params for known signatures ([#1408](https://github.com/ruby/rbs/pull/1408))
64
+ * Super class should be absolute paths. ([#1415](https://github.com/ruby/rbs/pull/1415))
65
+ * prototype rb: Fix a crash by "include foo" ([#1419](https://github.com/ruby/rbs/pull/1419))
66
+ * Add `--outline` option to `prototype runtime` to skip generating method definition ([#1404](https://github.com/ruby/rbs/pull/1404))
67
+ * [rbs prototype] Follow up ivar/cvar feature ([#1361](https://github.com/ruby/rbs/pull/1361))
68
+ * prototype rb: Extract instance variables and class variables ([#1343](https://github.com/ruby/rbs/pull/1343))
69
+
70
+ #### rbs collection
71
+
72
+ * Print warning when specified gem not found ([#1367](https://github.com/ruby/rbs/pull/1367))
73
+ * Generate gem specific sources in lockfile ([#1402](https://github.com/ruby/rbs/pull/1402))
74
+ * Spec may be missing when `rbs_collection.yaml` declares dependency ([#1378](https://github.com/ruby/rbs/pull/1378))
75
+
76
+ ### Miscellaneous
77
+
78
+ * Remove ruby-lsp && bundle update --bundler ([#1420](https://github.com/ruby/rbs/pull/1420))
79
+ * Delete all remaining set-related descriptions. ([#1324](https://github.com/ruby/rbs/pull/1324))
80
+ * Add customized test runner to accept minitest options ([#1392](https://github.com/ruby/rbs/pull/1392))
81
+ * Specify `rbs` syntax to code snippets in Markdown files ([#1366](https://github.com/ruby/rbs/pull/1366))
82
+ * Fix typo in parser.rbs ([#1352](https://github.com/ruby/rbs/pull/1352))
83
+ * Fix broken CI ([#1353](https://github.com/ruby/rbs/pull/1353))
84
+ * Handle connection error with Resolv_test.rb ([#1356](https://github.com/ruby/rbs/pull/1356))
85
+ * Removed Prime signature and tests ([#1355](https://github.com/ruby/rbs/pull/1355))
86
+
5
87
  ## 3.1.3 (2023-07-31)
6
88
 
7
89
  ### Library changes
data/Gemfile CHANGED
@@ -17,17 +17,11 @@ gem "goodcheck"
17
17
  gem "dbm"
18
18
  gem 'digest'
19
19
  gem 'tempfile'
20
- gem "prime"
21
20
  gem "rdoc", "~> 6.4.0"
22
21
 
23
22
  # Test gems
24
23
  gem "rbs-amber", path: "test/assets/test-gem"
25
24
 
26
- group :ide, optional: true do
27
- gem "ruby-debug-ide"
28
- gem "debase", ">= 0.2.5.beta2"
29
- end
30
-
31
25
  group :minitest do
32
26
  gem "minitest"
33
27
  end
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rbs (3.1.3)
4
+ rbs (3.2.0)
5
5
 
6
6
  PATH
7
7
  remote: test/assets/test-gem
@@ -14,13 +14,10 @@ GEM
14
14
  addressable (2.8.4)
15
15
  public_suffix (>= 2.0.2, < 6.0)
16
16
  ast (2.4.2)
17
+ base64 (0.1.1)
17
18
  dbm (1.1.0)
18
- debase (0.2.5.beta2)
19
- debase-ruby_core_source (>= 0.10.12)
20
- debase-ruby_core_source (3.2.1)
21
19
  diff-lcs (1.5.0)
22
20
  digest (3.1.1)
23
- forwardable (1.3.2)
24
21
  goodcheck (3.1.0)
25
22
  marcel (>= 1.0, < 2.0)
26
23
  psych (>= 3.1, < 5.0)
@@ -29,28 +26,26 @@ GEM
29
26
  json (2.6.3)
30
27
  json-schema (4.0.0)
31
28
  addressable (>= 2.8)
29
+ language_server-protocol (3.17.0.3)
32
30
  marcel (1.0.2)
33
- minitest (5.18.0)
31
+ minitest (5.19.0)
34
32
  parallel (1.23.0)
35
33
  parser (3.2.2.3)
36
34
  ast (~> 2.4.1)
37
35
  racc
38
36
  power_assert (2.0.3)
39
- prime (0.1.2)
40
- forwardable
41
- singleton
42
37
  psych (4.0.6)
43
38
  stringio
44
39
  public_suffix (5.0.1)
45
40
  racc (1.7.1)
46
41
  rainbow (3.1.1)
47
42
  rake (13.0.6)
48
- rake-compiler (1.2.2)
43
+ rake-compiler (1.2.5)
49
44
  rake
50
45
  rdoc (6.4.0)
51
46
  psych (>= 4.0.0)
52
47
  regexp_parser (2.8.1)
53
- rexml (3.2.5)
48
+ rexml (3.2.6)
54
49
  rspec (3.12.0)
55
50
  rspec-core (~> 3.12.0)
56
51
  rspec-expectations (~> 3.12.0)
@@ -64,29 +59,28 @@ GEM
64
59
  diff-lcs (>= 1.2.0, < 2.0)
65
60
  rspec-support (~> 3.12.0)
66
61
  rspec-support (3.12.0)
67
- rubocop (1.52.1)
62
+ rubocop (1.56.0)
63
+ base64 (~> 0.1.1)
68
64
  json (~> 2.3)
65
+ language_server-protocol (>= 3.17.0)
69
66
  parallel (~> 1.10)
70
67
  parser (>= 3.2.2.3)
71
68
  rainbow (>= 2.2.2, < 4.0)
72
69
  regexp_parser (>= 1.8, < 3.0)
73
70
  rexml (>= 3.2.5, < 4.0)
74
- rubocop-ast (>= 1.28.0, < 2.0)
71
+ rubocop-ast (>= 1.28.1, < 2.0)
75
72
  ruby-progressbar (~> 1.7)
76
73
  unicode-display_width (>= 2.4.0, < 3.0)
77
74
  rubocop-ast (1.29.0)
78
75
  parser (>= 3.2.1.0)
79
76
  rubocop-rubycw (0.1.6)
80
77
  rubocop (~> 1.0)
81
- ruby-debug-ide (0.7.3)
82
- rake (>= 0.8.1)
83
78
  ruby-progressbar (1.13.0)
84
- singleton (0.1.1)
85
79
  stackprof (0.2.25)
86
80
  stringio (3.0.7)
87
81
  strong_json (2.1.2)
88
82
  tempfile (0.1.3)
89
- test-unit (3.5.9)
83
+ test-unit (3.6.1)
90
84
  power_assert
91
85
  unicode-display_width (2.4.2)
92
86
 
@@ -96,13 +90,11 @@ PLATFORMS
96
90
 
97
91
  DEPENDENCIES
98
92
  dbm
99
- debase (>= 0.2.5.beta2)
100
93
  digest
101
94
  goodcheck
102
95
  json
103
96
  json-schema
104
97
  minitest
105
- prime
106
98
  rake
107
99
  rake-compiler
108
100
  rbs!
@@ -111,10 +103,9 @@ DEPENDENCIES
111
103
  rspec
112
104
  rubocop
113
105
  rubocop-rubycw
114
- ruby-debug-ide
115
106
  stackprof
116
107
  tempfile
117
108
  test-unit
118
109
 
119
110
  BUNDLED WITH
120
- 2.4.7
111
+ 2.4.18
data/README.md CHANGED
@@ -7,7 +7,7 @@ It also allows declaring constants and global variables.
7
7
  The following is a small example of RBS for a chat app.
8
8
 
9
9
  <!-- run-start:a.rbs:bundle exec rbs -I a.rbs validate -->
10
- ```rb
10
+ ```rbs
11
11
  module ChatApp
12
12
  VERSION: String
13
13
 
data/Rakefile CHANGED
@@ -82,7 +82,7 @@ FileList["test/stdlib/**/*_test.rb"].each do |test|
82
82
  end
83
83
  end
84
84
 
85
- task :stdlib_test do
85
+ task :stdlib_test => :compile do
86
86
  test_files = FileList["test/stdlib/**/*_test.rb"].reject do |path|
87
87
  path =~ %r{Ractor}
88
88
  end
@@ -310,3 +310,47 @@ NOTES
310
310
  end
311
311
  end
312
312
  end
313
+
314
+
315
+ desc "Generate changelog template from GH pull requests"
316
+ task :changelog do
317
+ major, minor, patch, _pre = RBS::VERSION.split(".", 4)
318
+ major = major.to_i
319
+ minor = minor.to_i
320
+ patch = patch.to_i
321
+
322
+ if patch == 0
323
+ milestone = "RBS #{major}.#{minor}"
324
+ else
325
+ milestone = "RBS #{major}.#{minor}.x"
326
+ end
327
+
328
+ puts "🔍 Finding pull requests that is associated to milestone `#{milestone}`..."
329
+
330
+ command = [
331
+ "gh",
332
+ "pr",
333
+ "list",
334
+ "--limit=10000",
335
+ "--json",
336
+ "url,title,number",
337
+ "--search" ,
338
+ "milestone:\"#{milestone}\" is:merged sort:updated-desc -label:Released"
339
+ ]
340
+
341
+ require "open3"
342
+ output, status = Open3.capture2(*command)
343
+ raise status.inspect unless status.success?
344
+
345
+ require "json"
346
+ json = JSON.parse(output, symbolize_names: true)
347
+
348
+ unless json.empty?
349
+ puts
350
+ json.each do |line|
351
+ puts "* #{line[:title]} ([##{line[:number]}](#{line[:url]}))"
352
+ end
353
+ else
354
+ puts " (🤑 There is no *unreleased* pull request associated to the milestone.)"
355
+ end
356
+ end
data/Steepfile CHANGED
@@ -9,7 +9,7 @@ target :lib do
9
9
  "lib/rbs/test.rb"
10
10
  )
11
11
 
12
- library "set", "pathname", "json", "logger", "monitor", "tsort", "uri", 'dbm', 'pstore', 'singleton', 'shellwords', 'fileutils', 'find', 'digest', 'abbrev'
12
+ library "pathname", "json", "logger", "monitor", "tsort", "uri", 'dbm', 'pstore', 'singleton', 'shellwords', 'fileutils', 'find', 'digest', 'abbrev'
13
13
  signature 'stdlib/yaml/0'
14
14
  signature "stdlib/strscan/0/"
15
15
  signature "stdlib/optparse/0/"
@@ -31,7 +31,7 @@ end
31
31
  # check "app/models/**/*.rb" # Glob
32
32
  # # ignore "lib/templates/*.rb"
33
33
  #
34
- # # library "pathname", "set" # Standard libraries
34
+ # # library "pathname", "uri" # Standard libraries
35
35
  # # library "strong_json" # Gems
36
36
  # end
37
37
 
@@ -40,6 +40,6 @@ end
40
40
  #
41
41
  # check "spec"
42
42
  #
43
- # # library "pathname", "set" # Standard libraries
43
+ # # library "pathname", "uri" # Standard libraries
44
44
  # # library "rspec"
45
45
  # end
data/core/array.rbs CHANGED
@@ -3920,14 +3920,6 @@ class Array[unchecked out Elem] < Object
3920
3920
  def initialize_copy: (self other_ary) -> void
3921
3921
  end
3922
3922
 
3923
- interface _ToA[T]
3924
- def to_a: () -> Array[T]
3925
- end
3926
-
3927
- interface _ToAry[T]
3928
- def to_ary: () -> ::Array[T]
3929
- end
3930
-
3931
3923
  interface _Rand
3932
3924
  def rand: (::Integer max) -> ::Integer
3933
3925
  end
data/core/binding.rbs CHANGED
@@ -30,10 +30,10 @@
30
30
  # Binding objects have no class-specific methods.
31
31
  #
32
32
  class Binding
33
- public
34
-
35
33
  def clone: () -> self
36
34
 
35
+ def dup: () -> self
36
+
37
37
  # <!--
38
38
  # rdoc-file=proc.c
39
39
  # - binding.eval(string [, filename [,lineno]]) -> obj
@@ -48,69 +48,7 @@ class Binding
48
48
  # b = get_binding("hello")
49
49
  # b.eval("param") #=> "hello"
50
50
  #
51
- def eval: (String arg0, ?String filename, ?Integer lineno) -> untyped
52
-
53
- # <!--
54
- # rdoc-file=lib/irb.rb
55
- # - irb(show_code: true)
56
- # -->
57
- # Opens an IRB session where `binding.irb` is called which allows for
58
- # interactive debugging. You can call any methods or variables available in the
59
- # current scope, and mutate state if you need to.
60
- #
61
- # Given a Ruby file called `potato.rb` containing the following code:
62
- #
63
- # class Potato
64
- # def initialize
65
- # @cooked = false
66
- # binding.irb
67
- # puts "Cooked potato: #{@cooked}"
68
- # end
69
- # end
70
- #
71
- # Potato.new
72
- #
73
- # Running `ruby potato.rb` will open an IRB session where `binding.irb` is
74
- # called, and you will see the following:
75
- #
76
- # $ ruby potato.rb
77
- #
78
- # From: potato.rb @ line 4 :
79
- #
80
- # 1: class Potato
81
- # 2: def initialize
82
- # 3: @cooked = false
83
- # => 4: binding.irb
84
- # 5: puts "Cooked potato: #{@cooked}"
85
- # 6: end
86
- # 7: end
87
- # 8:
88
- # 9: Potato.new
89
- #
90
- # irb(#<Potato:0x00007feea1916670>):001:0>
91
- #
92
- # You can type any valid Ruby code and it will be evaluated in the current
93
- # context. This allows you to debug without having to run your code repeatedly:
94
- #
95
- # irb(#<Potato:0x00007feea1916670>):001:0> @cooked
96
- # => false
97
- # irb(#<Potato:0x00007feea1916670>):002:0> self.class
98
- # => Potato
99
- # irb(#<Potato:0x00007feea1916670>):003:0> caller.first
100
- # => ".../2.5.1/lib/ruby/2.5.0/irb/workspace.rb:85:in `eval'"
101
- # irb(#<Potato:0x00007feea1916670>):004:0> @cooked = true
102
- # => true
103
- #
104
- # You can exit the IRB session with the `exit` command. Note that exiting will
105
- # resume execution where `binding.irb` had paused it, as you can see from the
106
- # output printed to standard output in this example:
107
- #
108
- # irb(#<Potato:0x00007feea1916670>):005:0> exit
109
- # Cooked potato: true
110
- #
111
- # See IRB@IRB+Usage for more information.
112
- #
113
- def irb: () -> void
51
+ def eval: (string src, ?string filename, ?int lineno) -> untyped
114
52
 
115
53
  # <!--
116
54
  # rdoc-file=proc.c
@@ -128,7 +66,7 @@ class Binding
128
66
  #
129
67
  # binding.eval("defined?(#{symbol}) == 'local-variable'")
130
68
  #
131
- def local_variable_defined?: (String | Symbol symbol) -> bool
69
+ def local_variable_defined?: (Symbol | string varname) -> bool
132
70
 
133
71
  # <!--
134
72
  # rdoc-file=proc.c
@@ -146,7 +84,7 @@ class Binding
146
84
  #
147
85
  # binding.eval("#{symbol}")
148
86
  #
149
- def local_variable_get: (String | Symbol symbol) -> untyped
87
+ def local_variable_get: (Symbol | string varname) -> untyped
150
88
 
151
89
  # <!--
152
90
  # rdoc-file=proc.c
@@ -173,7 +111,7 @@ class Binding
173
111
  #
174
112
  # if `obj` can be dumped in Ruby code.
175
113
  #
176
- def local_variable_set: [U] (String | Symbol symbol, U obj) -> U
114
+ def local_variable_set: [U] (Symbol | string varname, U obj) -> U
177
115
 
178
116
  # <!--
179
117
  # rdoc-file=proc.c
@@ -208,5 +146,5 @@ class Binding
208
146
  # -->
209
147
  # Returns the Ruby source filename and line number of the binding object.
210
148
  #
211
- def source_location: () -> [ String, Integer ]
149
+ def source_location: () -> [String, Integer]
212
150
  end
data/core/builtin.rbs CHANGED
@@ -1,3 +1,15 @@
1
+ interface _ToC
2
+ def to_c: () -> Complex
3
+ end
4
+
5
+ interface _ToR
6
+ def to_r: () -> Rational
7
+ end
8
+
9
+ interface _ToF
10
+ def to_f: () -> Float
11
+ end
12
+
1
13
  interface _ToI
2
14
  def to_i: () -> Integer
3
15
  end
@@ -6,26 +18,34 @@ interface _ToInt
6
18
  def to_int: () -> Integer
7
19
  end
8
20
 
9
- interface _ToR
10
- def to_r: () -> Rational
11
- end
12
-
13
21
  interface _ToS
14
22
  def to_s: () -> String
15
23
  end
16
24
 
17
- interface _ToF
18
- def to_f: () -> Float
19
- end
20
-
21
25
  interface _ToStr
22
26
  def to_str: () -> String
23
27
  end
24
28
 
29
+ interface _ToSym
30
+ def to_sym: () -> Symbol
31
+ end
32
+
33
+ interface _ToH[K, V]
34
+ def to_h: () -> Hash[K, V]
35
+ end
36
+
25
37
  interface _ToHash[K, V]
26
38
  def to_hash: () -> Hash[K, V]
27
39
  end
28
40
 
41
+ interface _ToA[T]
42
+ def to_a: () -> Array[T]
43
+ end
44
+
45
+ interface _ToAry[T]
46
+ def to_ary: () -> Array[T]
47
+ end
48
+
29
49
  interface _ToProc
30
50
  def to_proc: () -> Proc
31
51
  end
@@ -34,6 +54,10 @@ interface _ToPath
34
54
  def to_path: () -> String
35
55
  end
36
56
 
57
+ interface _Inspect
58
+ def inspect: () -> String
59
+ end
60
+
37
61
  interface _Each[out A]
38
62
  def each: () { (A) -> void } -> void
39
63
  end
@@ -75,6 +99,7 @@ type real = Integer | Float | Rational
75
99
 
76
100
  type string = String | _ToStr
77
101
  type encoding = Encoding | string
102
+ type path = string | _ToPath
78
103
 
79
104
  type io = IO | _ToIO
80
105
 
data/core/constants.rbs CHANGED
@@ -15,9 +15,19 @@
15
15
 
16
16
  ::CROSS_COMPILING: NilClass
17
17
 
18
- ::FALSE: FalseClass
19
-
20
- ::NIL: NilClass
18
+ # <!-- rdoc-file=ruby.c -->
19
+ # DATA is a File that contains the data section of the executed file. To create
20
+ # a data section use `__END__`:
21
+ #
22
+ # $ cat t.rb
23
+ # puts DATA.gets
24
+ # __END__
25
+ # hello world!
26
+ #
27
+ # $ ruby t.rb
28
+ # hello world!
29
+ #
30
+ ::DATA: File
21
31
 
22
32
  # <!-- rdoc-file=version.c -->
23
33
  # The copyright string for ruby
@@ -84,5 +94,3 @@
84
94
  # The Binding of the top level scope
85
95
  #
86
96
  ::TOPLEVEL_BINDING: Binding
87
-
88
- ::TRUE: TrueClass