steep 0.11.1 → 0.12.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 (299) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +27 -0
  3. data/.gitmodules +3 -0
  4. data/CHANGELOG.md +5 -0
  5. data/README.md +48 -90
  6. data/Rakefile +10 -6
  7. data/Steepfile +1 -0
  8. data/bin/setup +1 -0
  9. data/bin/smoke_runner.rb +9 -14
  10. data/exe/rbs +3 -0
  11. data/exe/ruby-signature +3 -0
  12. data/exe/steep +1 -0
  13. data/lib/steep.rb +32 -26
  14. data/lib/steep/annotation_parser.rb +167 -0
  15. data/lib/steep/ast/annotation/collection.rb +7 -7
  16. data/lib/steep/ast/types.rb +60 -0
  17. data/lib/steep/ast/types/any.rb +1 -1
  18. data/lib/steep/ast/types/factory.rb +535 -0
  19. data/lib/steep/ast/types/name.rb +3 -3
  20. data/lib/steep/ast/types/var.rb +1 -1
  21. data/lib/steep/cli.rb +56 -240
  22. data/lib/steep/drivers/annotations.rb +36 -19
  23. data/lib/steep/drivers/check.rb +55 -91
  24. data/lib/steep/drivers/init.rb +54 -0
  25. data/lib/steep/drivers/langserver.rb +241 -150
  26. data/lib/steep/drivers/print_project.rb +56 -0
  27. data/lib/steep/drivers/signature_error_printer.rb +25 -0
  28. data/lib/steep/drivers/trace_printer.rb +25 -0
  29. data/lib/steep/drivers/utils/driver_helper.rb +26 -0
  30. data/lib/steep/drivers/validate.rb +18 -38
  31. data/lib/steep/drivers/vendor.rb +46 -0
  32. data/lib/steep/drivers/watch.rb +78 -140
  33. data/lib/steep/errors.rb +22 -13
  34. data/lib/steep/interface/interface.rb +91 -0
  35. data/lib/steep/interface/method.rb +0 -4
  36. data/lib/steep/interface/method_type.rb +362 -2
  37. data/lib/steep/interface/substitution.rb +22 -0
  38. data/lib/steep/project.rb +25 -233
  39. data/lib/steep/project/dsl.rb +132 -0
  40. data/lib/steep/project/file.rb +93 -76
  41. data/lib/steep/project/file_loader.rb +63 -0
  42. data/lib/steep/project/options.rb +7 -0
  43. data/lib/steep/project/target.rb +190 -0
  44. data/lib/steep/signature/errors.rb +25 -77
  45. data/lib/steep/signature/validator.rb +122 -0
  46. data/lib/steep/source.rb +12 -7
  47. data/lib/steep/subtyping/check.rb +357 -633
  48. data/lib/steep/subtyping/constraints.rb +2 -2
  49. data/lib/steep/subtyping/trace.rb +23 -0
  50. data/lib/steep/type_construction.rb +509 -455
  51. data/lib/steep/type_inference/constant_env.rb +16 -24
  52. data/lib/steep/type_inference/type_env.rb +26 -18
  53. data/lib/steep/version.rb +1 -1
  54. data/sample/Steepfile +6 -0
  55. data/sample/lib/conference.rb +12 -0
  56. data/sample/sig/conference.rbs +6 -0
  57. data/smoke/alias/Steepfile +4 -0
  58. data/smoke/alias/a.rb +2 -2
  59. data/smoke/alias/{a.rbi → a.rbs} +1 -1
  60. data/smoke/and/Steepfile +4 -0
  61. data/smoke/array/Steepfile +4 -0
  62. data/smoke/array/a.rb +2 -2
  63. data/smoke/array/b.rb +4 -4
  64. data/smoke/array/c.rb +2 -2
  65. data/smoke/block/Steepfile +5 -0
  66. data/smoke/block/{a.rbi → a.rbs} +1 -1
  67. data/smoke/block/{c.rbi → c.rbs} +0 -0
  68. data/smoke/block/d.rb +6 -6
  69. data/smoke/case/Steepfile +4 -0
  70. data/smoke/case/a.rb +4 -3
  71. data/smoke/class/Steepfile +4 -0
  72. data/smoke/class/a.rb +1 -4
  73. data/smoke/class/a.rbs +24 -0
  74. data/smoke/class/h.rb +6 -2
  75. data/smoke/class/{h.rbi → h.rbs} +1 -2
  76. data/smoke/class/i.rb +1 -2
  77. data/smoke/class/i.rbs +9 -0
  78. data/smoke/const/Steepfile +4 -0
  79. data/smoke/dstr/Steepfile +4 -0
  80. data/smoke/ensure/Steepfile +4 -0
  81. data/smoke/ensure/a.rb +1 -1
  82. data/smoke/enumerator/Steepfile +4 -0
  83. data/smoke/enumerator/a.rb +7 -7
  84. data/smoke/enumerator/b.rb +6 -6
  85. data/smoke/extension/Steepfile +4 -0
  86. data/smoke/extension/{a.rbi → a.rbs} +2 -2
  87. data/smoke/extension/{e.rbi → e.rbs} +2 -2
  88. data/smoke/hash/Steepfile +4 -0
  89. data/smoke/hash/{a.rbi → a.rbs} +0 -0
  90. data/smoke/hash/b.rb +2 -2
  91. data/smoke/hash/c.rb +1 -1
  92. data/smoke/hash/e.rbs +3 -0
  93. data/smoke/hash/f.rb +1 -1
  94. data/smoke/hello/Steepfile +4 -0
  95. data/smoke/hello/hello.rbs +7 -0
  96. data/smoke/if/Steepfile +4 -0
  97. data/smoke/implements/Steepfile +4 -0
  98. data/smoke/implements/a.rbs +6 -0
  99. data/smoke/initialize/Steepfile +4 -0
  100. data/smoke/initialize/a.rbs +3 -0
  101. data/smoke/integer/Steepfile +4 -0
  102. data/smoke/integer/a.rb +5 -3
  103. data/smoke/interface/Steepfile +4 -0
  104. data/smoke/interface/{a.rbi → a.rbs} +0 -0
  105. data/smoke/kwbegin/Steepfile +4 -0
  106. data/smoke/lambda/Steepfile +4 -0
  107. data/smoke/lambda/a.rb +9 -2
  108. data/smoke/literal/Steepfile +4 -0
  109. data/smoke/literal/{literal_methods.rbi → literal_methods.rbs} +0 -0
  110. data/smoke/map/Steepfile +4 -0
  111. data/smoke/map/a.rb +1 -1
  112. data/smoke/method/Steepfile +4 -0
  113. data/smoke/method/{a.rbi → a.rbs} +0 -0
  114. data/smoke/method/b.rb +1 -4
  115. data/smoke/method/d.rb +1 -0
  116. data/smoke/method/d.rbs +3 -0
  117. data/smoke/module/Steepfile +4 -0
  118. data/smoke/module/a.rb +1 -1
  119. data/smoke/module/a.rbs +16 -0
  120. data/smoke/module/c.rb +1 -1
  121. data/smoke/regexp/Steepfile +4 -0
  122. data/smoke/regexp/a.rb +2 -2
  123. data/smoke/regexp/b.rb +16 -16
  124. data/smoke/regression/Steepfile +5 -0
  125. data/smoke/regression/array.rb +2 -2
  126. data/smoke/regression/hash.rb +2 -2
  127. data/smoke/regression/poly_new.rb +2 -0
  128. data/smoke/regression/poly_new.rbs +4 -0
  129. data/smoke/regression/set_divide.rb +2 -2
  130. data/smoke/rescue/Steepfile +4 -0
  131. data/smoke/rescue/a.rb +1 -1
  132. data/smoke/self/Steepfile +4 -0
  133. data/smoke/self/a.rbs +4 -0
  134. data/smoke/skip/Steepfile +4 -0
  135. data/smoke/stdout/Steepfile +4 -0
  136. data/smoke/stdout/{a.rbi → a.rbs} +1 -1
  137. data/smoke/super/Steepfile +4 -0
  138. data/smoke/super/a.rbs +10 -0
  139. data/smoke/type_case/Steepfile +4 -0
  140. data/smoke/type_case/a.rb +1 -1
  141. data/smoke/yield/Steepfile +4 -0
  142. data/smoke/yield/a.rb +2 -2
  143. data/steep.gemspec +14 -7
  144. data/vendor/ruby-signature/.github/workflows/ruby.yml +27 -0
  145. data/vendor/ruby-signature/.gitignore +12 -0
  146. data/vendor/ruby-signature/.rubocop.yml +15 -0
  147. data/vendor/ruby-signature/BSDL +22 -0
  148. data/vendor/ruby-signature/COPYING +56 -0
  149. data/vendor/ruby-signature/Gemfile +6 -0
  150. data/vendor/ruby-signature/README.md +93 -0
  151. data/vendor/ruby-signature/Rakefile +66 -0
  152. data/vendor/ruby-signature/bin/annotate-with-rdoc +156 -0
  153. data/vendor/ruby-signature/bin/console +14 -0
  154. data/vendor/ruby-signature/bin/query-rdoc +103 -0
  155. data/vendor/ruby-signature/bin/setup +10 -0
  156. data/vendor/ruby-signature/bin/sort +88 -0
  157. data/vendor/ruby-signature/bin/test_runner.rb +17 -0
  158. data/vendor/ruby-signature/docs/CONTRIBUTING.md +97 -0
  159. data/vendor/ruby-signature/docs/sigs.md +148 -0
  160. data/vendor/ruby-signature/docs/stdlib.md +152 -0
  161. data/vendor/ruby-signature/docs/syntax.md +528 -0
  162. data/vendor/ruby-signature/exe/rbs +3 -0
  163. data/vendor/ruby-signature/exe/ruby-signature +7 -0
  164. data/vendor/ruby-signature/lib/ruby/signature.rb +64 -0
  165. data/vendor/ruby-signature/lib/ruby/signature/ast/annotation.rb +29 -0
  166. data/vendor/ruby-signature/lib/ruby/signature/ast/comment.rb +29 -0
  167. data/vendor/ruby-signature/lib/ruby/signature/ast/declarations.rb +391 -0
  168. data/vendor/ruby-signature/lib/ruby/signature/ast/members.rb +364 -0
  169. data/vendor/ruby-signature/lib/ruby/signature/buffer.rb +52 -0
  170. data/vendor/ruby-signature/lib/ruby/signature/builtin_names.rb +54 -0
  171. data/vendor/ruby-signature/lib/ruby/signature/cli.rb +534 -0
  172. data/vendor/ruby-signature/lib/ruby/signature/constant.rb +28 -0
  173. data/vendor/ruby-signature/lib/ruby/signature/constant_table.rb +152 -0
  174. data/vendor/ruby-signature/lib/ruby/signature/definition.rb +172 -0
  175. data/vendor/ruby-signature/lib/ruby/signature/definition_builder.rb +921 -0
  176. data/vendor/ruby-signature/lib/ruby/signature/environment.rb +283 -0
  177. data/vendor/ruby-signature/lib/ruby/signature/environment_loader.rb +138 -0
  178. data/vendor/ruby-signature/lib/ruby/signature/environment_walker.rb +126 -0
  179. data/vendor/ruby-signature/lib/ruby/signature/errors.rb +189 -0
  180. data/vendor/ruby-signature/lib/ruby/signature/location.rb +104 -0
  181. data/vendor/ruby-signature/lib/ruby/signature/method_type.rb +125 -0
  182. data/vendor/ruby-signature/lib/ruby/signature/namespace.rb +93 -0
  183. data/vendor/ruby-signature/lib/ruby/signature/parser.y +1343 -0
  184. data/vendor/ruby-signature/lib/ruby/signature/prototype/rb.rb +441 -0
  185. data/vendor/ruby-signature/lib/ruby/signature/prototype/rbi.rb +579 -0
  186. data/vendor/ruby-signature/lib/ruby/signature/prototype/runtime.rb +383 -0
  187. data/vendor/ruby-signature/lib/ruby/signature/substitution.rb +48 -0
  188. data/vendor/ruby-signature/lib/ruby/signature/test.rb +28 -0
  189. data/vendor/ruby-signature/lib/ruby/signature/test/errors.rb +63 -0
  190. data/vendor/ruby-signature/lib/ruby/signature/test/hook.rb +290 -0
  191. data/vendor/ruby-signature/lib/ruby/signature/test/setup.rb +58 -0
  192. data/vendor/ruby-signature/lib/ruby/signature/test/spy.rb +324 -0
  193. data/vendor/ruby-signature/lib/ruby/signature/test/test_helper.rb +185 -0
  194. data/vendor/ruby-signature/lib/ruby/signature/test/type_check.rb +256 -0
  195. data/vendor/ruby-signature/lib/ruby/signature/type_name.rb +72 -0
  196. data/vendor/ruby-signature/lib/ruby/signature/types.rb +932 -0
  197. data/vendor/ruby-signature/lib/ruby/signature/variance_calculator.rb +140 -0
  198. data/vendor/ruby-signature/lib/ruby/signature/vendorer.rb +49 -0
  199. data/vendor/ruby-signature/lib/ruby/signature/version.rb +5 -0
  200. data/vendor/ruby-signature/lib/ruby/signature/writer.rb +271 -0
  201. data/vendor/ruby-signature/ruby-signature.gemspec +45 -0
  202. data/vendor/ruby-signature/stdlib/abbrev/abbrev.rbs +3 -0
  203. data/vendor/ruby-signature/stdlib/base64/base64.rbs +15 -0
  204. data/vendor/ruby-signature/stdlib/builtin/array.rbs +1997 -0
  205. data/vendor/ruby-signature/stdlib/builtin/basic_object.rbs +280 -0
  206. data/vendor/ruby-signature/stdlib/builtin/binding.rbs +177 -0
  207. data/vendor/ruby-signature/stdlib/builtin/builtin.rbs +35 -0
  208. data/vendor/ruby-signature/stdlib/builtin/class.rbs +145 -0
  209. data/vendor/ruby-signature/stdlib/builtin/comparable.rbs +116 -0
  210. data/vendor/ruby-signature/stdlib/builtin/complex.rbs +400 -0
  211. data/vendor/ruby-signature/stdlib/builtin/constants.rbs +37 -0
  212. data/vendor/ruby-signature/stdlib/builtin/data.rbs +5 -0
  213. data/vendor/ruby-signature/stdlib/builtin/deprecated.rbs +2 -0
  214. data/vendor/ruby-signature/stdlib/builtin/dir.rbs +419 -0
  215. data/vendor/ruby-signature/stdlib/builtin/encoding.rbs +606 -0
  216. data/vendor/ruby-signature/stdlib/builtin/enumerable.rbs +404 -0
  217. data/vendor/ruby-signature/stdlib/builtin/enumerator.rbs +260 -0
  218. data/vendor/ruby-signature/stdlib/builtin/errno.rbs +781 -0
  219. data/vendor/ruby-signature/stdlib/builtin/errors.rbs +582 -0
  220. data/vendor/ruby-signature/stdlib/builtin/exception.rbs +193 -0
  221. data/vendor/ruby-signature/stdlib/builtin/false_class.rbs +40 -0
  222. data/vendor/ruby-signature/stdlib/builtin/fiber.rbs +68 -0
  223. data/vendor/ruby-signature/stdlib/builtin/fiber_error.rbs +12 -0
  224. data/vendor/ruby-signature/stdlib/builtin/file.rbs +476 -0
  225. data/vendor/ruby-signature/stdlib/builtin/file_test.rbs +59 -0
  226. data/vendor/ruby-signature/stdlib/builtin/float.rbs +696 -0
  227. data/vendor/ruby-signature/stdlib/builtin/gc.rbs +121 -0
  228. data/vendor/ruby-signature/stdlib/builtin/hash.rbs +1029 -0
  229. data/vendor/ruby-signature/stdlib/builtin/integer.rbs +710 -0
  230. data/vendor/ruby-signature/stdlib/builtin/io.rbs +683 -0
  231. data/vendor/ruby-signature/stdlib/builtin/kernel.rbs +574 -0
  232. data/vendor/ruby-signature/stdlib/builtin/marshal.rbs +135 -0
  233. data/vendor/ruby-signature/stdlib/builtin/match_data.rbs +141 -0
  234. data/vendor/ruby-signature/stdlib/builtin/math.rbs +66 -0
  235. data/vendor/ruby-signature/stdlib/builtin/method.rbs +182 -0
  236. data/vendor/ruby-signature/stdlib/builtin/module.rbs +248 -0
  237. data/vendor/ruby-signature/stdlib/builtin/nil_class.rbs +82 -0
  238. data/vendor/ruby-signature/stdlib/builtin/numeric.rbs +409 -0
  239. data/vendor/ruby-signature/stdlib/builtin/object.rbs +824 -0
  240. data/vendor/ruby-signature/stdlib/builtin/proc.rbs +426 -0
  241. data/vendor/ruby-signature/stdlib/builtin/process.rbs +354 -0
  242. data/vendor/ruby-signature/stdlib/builtin/random.rbs +93 -0
  243. data/vendor/ruby-signature/stdlib/builtin/range.rbs +226 -0
  244. data/vendor/ruby-signature/stdlib/builtin/rational.rbs +424 -0
  245. data/vendor/ruby-signature/stdlib/builtin/rb_config.rbs +10 -0
  246. data/vendor/ruby-signature/stdlib/builtin/regexp.rbs +131 -0
  247. data/vendor/ruby-signature/stdlib/builtin/ruby_vm.rbs +14 -0
  248. data/vendor/ruby-signature/stdlib/builtin/signal.rbs +55 -0
  249. data/vendor/ruby-signature/stdlib/builtin/string.rbs +770 -0
  250. data/vendor/ruby-signature/stdlib/builtin/string_io.rbs +13 -0
  251. data/vendor/ruby-signature/stdlib/builtin/struct.rbs +40 -0
  252. data/vendor/ruby-signature/stdlib/builtin/symbol.rbs +230 -0
  253. data/vendor/ruby-signature/stdlib/builtin/thread.rbs +1112 -0
  254. data/vendor/ruby-signature/stdlib/builtin/thread_group.rbs +23 -0
  255. data/vendor/ruby-signature/stdlib/builtin/time.rbs +739 -0
  256. data/vendor/ruby-signature/stdlib/builtin/trace_point.rbs +91 -0
  257. data/vendor/ruby-signature/stdlib/builtin/true_class.rbs +46 -0
  258. data/vendor/ruby-signature/stdlib/builtin/unbound_method.rbs +159 -0
  259. data/vendor/ruby-signature/stdlib/builtin/warning.rbs +17 -0
  260. data/vendor/ruby-signature/stdlib/erb/erb.rbs +18 -0
  261. data/vendor/ruby-signature/stdlib/find/find.rbs +44 -0
  262. data/vendor/ruby-signature/stdlib/pathname/pathname.rbs +21 -0
  263. data/vendor/ruby-signature/stdlib/prime/integer-extension.rbs +23 -0
  264. data/vendor/ruby-signature/stdlib/prime/prime.rbs +188 -0
  265. data/vendor/ruby-signature/stdlib/securerandom/securerandom.rbs +9 -0
  266. data/vendor/ruby-signature/stdlib/set/set.rbs +77 -0
  267. data/vendor/ruby-signature/stdlib/tmpdir/tmpdir.rbs +53 -0
  268. metadata +244 -54
  269. data/.travis.yml +0 -7
  270. data/lib/steep/ast/signature/alias.rb +0 -19
  271. data/lib/steep/ast/signature/class.rb +0 -33
  272. data/lib/steep/ast/signature/const.rb +0 -17
  273. data/lib/steep/ast/signature/env.rb +0 -138
  274. data/lib/steep/ast/signature/extension.rb +0 -21
  275. data/lib/steep/ast/signature/gvar.rb +0 -17
  276. data/lib/steep/ast/signature/interface.rb +0 -31
  277. data/lib/steep/ast/signature/members.rb +0 -115
  278. data/lib/steep/ast/signature/module.rb +0 -21
  279. data/lib/steep/drivers/print_interface.rb +0 -94
  280. data/lib/steep/drivers/scaffold.rb +0 -321
  281. data/lib/steep/drivers/utils/each_signature.rb +0 -31
  282. data/lib/steep/interface/abstract.rb +0 -68
  283. data/lib/steep/interface/builder.rb +0 -637
  284. data/lib/steep/interface/instantiated.rb +0 -163
  285. data/lib/steep/interface/ivar_chain.rb +0 -26
  286. data/lib/steep/parser.y +0 -1278
  287. data/lib/steep/project/listener.rb +0 -53
  288. data/smoke/class/a.rbi +0 -24
  289. data/smoke/class/d.rb +0 -9
  290. data/smoke/class/e.rb +0 -12
  291. data/smoke/class/i.rbi +0 -9
  292. data/smoke/hash/e.rbi +0 -3
  293. data/smoke/hello/hello.rbi +0 -7
  294. data/smoke/implements/a.rbi +0 -6
  295. data/smoke/initialize/a.rbi +0 -3
  296. data/smoke/module/a.rbi +0 -16
  297. data/smoke/self/a.rbi +0 -4
  298. data/smoke/super/a.rbi +0 -10
  299. data/stdlib/builtin.rbi +0 -787
@@ -0,0 +1,10 @@
1
+ module RbConfig
2
+ end
3
+
4
+ RbConfig::CONFIG: Hash[String, String]
5
+
6
+ RbConfig::DESTDIR: String
7
+
8
+ RbConfig::MAKEFILE_CONFIG: Hash[String, String]
9
+
10
+ RbConfig::TOPDIR: String
@@ -0,0 +1,131 @@
1
+ class Regexp < Object
2
+ def self.escape: (String | Symbol arg0) -> String
3
+
4
+ def self.last_match: () -> MatchData?
5
+ | (Integer n) -> String?
6
+ | (Symbol | String n) -> String?
7
+
8
+ def self.try_convert: (untyped obj) -> Regexp?
9
+
10
+ def ==: (untyped other) -> bool
11
+
12
+ def ===: (untyped other) -> bool
13
+
14
+ def =~: (String? str) -> Integer?
15
+
16
+ # Returns the value of the case-insensitive flag.
17
+ #
18
+ # ```ruby
19
+ # /a/.casefold? #=> false
20
+ # /a/i.casefold? #=> true
21
+ # /(?i:a)/.casefold? #=> false
22
+ # ```
23
+ def casefold?: () -> bool
24
+
25
+ # Returns the [Encoding](https://ruby-doc.org/core-2.6.3/Encoding.html)
26
+ # object that represents the encoding of obj.
27
+ def encoding: () -> Encoding
28
+
29
+ def fixed_encoding?: () -> bool
30
+
31
+ # Produce a hash based on the text and options of this regular expression.
32
+ #
33
+ # See also Object\#hash.
34
+ def hash: () -> Integer
35
+
36
+ def initialize: (String arg0, ?untyped options, ?String kcode) -> Object
37
+ | (Regexp arg0) -> void
38
+
39
+ # Produce a nicely formatted string-version of *rxp* . Perhaps
40
+ # surprisingly, `#inspect` actually produces the more natural version of
41
+ # the string than `#to_s` .
42
+ #
43
+ # ```ruby
44
+ # /ab+c/ix.inspect #=> "/ab+c/ix"
45
+ # ```
46
+ def inspect: () -> String
47
+
48
+ def match: (String? | Symbol | _ToStr arg0, ?Integer arg1) -> MatchData?
49
+ | (String? | Symbol | _ToStr arg0, ?Integer arg1) { (MatchData) -> untyped } -> untyped
50
+
51
+ def match?: (String? | Symbol | _ToStr arg0, ?Integer arg1) -> bool
52
+
53
+ def named_captures: () -> ::Hash[String, ::Array[Integer]]
54
+
55
+ def names: () -> ::Array[String]
56
+
57
+ # Returns the set of bits corresponding to the options used when creating
58
+ # this [Regexp](Regexp.downloaded.ruby_doc) (see `Regexp::new` for
59
+ # details. Note that additional bits may be set in the returned options:
60
+ # these are used internally by the regular expression code. These extra
61
+ # bits are ignored if the options are passed to `Regexp::new` .
62
+ #
63
+ # ```ruby
64
+ # Regexp::IGNORECASE #=> 1
65
+ # Regexp::EXTENDED #=> 2
66
+ # Regexp::MULTILINE #=> 4
67
+ #
68
+ # /cat/.options #=> 0
69
+ # /cat/ix.options #=> 3
70
+ # Regexp.new('cat', true).options #=> 1
71
+ # /\xa1\xa2/e.options #=> 16
72
+ #
73
+ # r = /cat/ix
74
+ # Regexp.new(r.source, r.options) #=> /cat/ix
75
+ # ```
76
+ def options: () -> Integer
77
+
78
+ # Returns the original string of the pattern.
79
+ #
80
+ # ```ruby
81
+ # /ab+c/ix.source #=> "ab+c"
82
+ # ```
83
+ #
84
+ # Note that escape sequences are retained as is.
85
+ #
86
+ # ```ruby
87
+ # /\x20\+/.source #=> "\\x20\\+"
88
+ # ```
89
+ def source: () -> String
90
+
91
+ # Returns a string containing the regular expression and its options
92
+ # (using the `(?opts:source)` notation. This string can be fed back in to
93
+ # `Regexp::new` to a regular expression with the same semantics as the
94
+ # original. (However, `Regexp#==` may not return true when comparing the
95
+ # two, as the source of the regular expression itself may differ, as the
96
+ # example shows). `Regexp#inspect` produces a generally more readable
97
+ # version of *rxp* .
98
+ #
99
+ # ```ruby
100
+ # r1 = /ab+c/ix #=> /ab+c/ix
101
+ # s1 = r1.to_s #=> "(?ix-m:ab+c)"
102
+ # r2 = Regexp.new(s1) #=> /(?ix-m:ab+c)/
103
+ # r1 == r2 #=> false
104
+ # r1.source #=> "ab+c"
105
+ # r2.source #=> "(?ix-m:ab+c)"
106
+ # ```
107
+ def to_s: () -> String
108
+
109
+ def ~: () -> Integer?
110
+
111
+ def self.compile: (String arg0, ?untyped options, ?String kcode) -> Regexp
112
+ | (Regexp arg0) -> Regexp
113
+
114
+ def self.quote: (String | Symbol arg0) -> String
115
+
116
+ def self.union: () -> Regexp
117
+ | (String | Regexp arg0, *String | Regexp args) -> Regexp
118
+ | (::Array[String | Regexp]) -> Regexp
119
+
120
+ def eql?: (untyped other) -> bool
121
+ end
122
+
123
+ Regexp::EXTENDED: Integer
124
+
125
+ Regexp::FIXEDENCODING: Integer
126
+
127
+ Regexp::IGNORECASE: Integer
128
+
129
+ Regexp::MULTILINE: Integer
130
+
131
+ Regexp::NOENCODING: Integer
@@ -0,0 +1,14 @@
1
+ # The [RubyVM](RubyVM) module provides some access to
2
+ # Ruby internals. This module is for very limited purposes, such as
3
+ # debugging, prototyping, and research. Normal users must not use it.
4
+ class RubyVM < Object
5
+ end
6
+
7
+ RubyVM::DEFAULT_PARAMS: Hash[Symbol, Integer]
8
+
9
+ RubyVM::INSTRUCTION_NAMES: Array[String]
10
+
11
+ RubyVM::OPTS: Array[String]
12
+
13
+ class RubyVM::InstructionSequence < Object
14
+ end
@@ -0,0 +1,55 @@
1
+ # Many operating systems allow signals to be sent to running processes.
2
+ # Some signals have a defined effect on the process, while others may be
3
+ # trapped at the code level and acted upon. For example, your process may
4
+ # trap the USR1 signal and use it to toggle debugging, and may use TERM to
5
+ # initiate a controlled shutdown.
6
+ #
7
+ # ```ruby
8
+ # pid = fork do
9
+ # Signal.trap("USR1") do
10
+ # $debug = !$debug
11
+ # puts "Debug now: #$debug"
12
+ # end
13
+ # Signal.trap("TERM") do
14
+ # puts "Terminating..."
15
+ # shutdown()
16
+ # end
17
+ # # . . . do some work . . .
18
+ # end
19
+ #
20
+ # Process.detach(pid)
21
+ #
22
+ # # Controlling program:
23
+ # Process.kill("USR1", pid)
24
+ # # ...
25
+ # Process.kill("USR1", pid)
26
+ # # ...
27
+ # Process.kill("TERM", pid)
28
+ # ```
29
+ #
30
+ # produces:
31
+ #
32
+ # ```
33
+ # Debug now: true
34
+ # Debug now: false
35
+ # Terminating...
36
+ # ```
37
+ #
38
+ # The list of available signal names and their interpretation is system
39
+ # dependent. [Signal](Signal) delivery semantics may
40
+ # also vary between systems; in particular signal delivery may not always
41
+ # be reliable.
42
+ module Signal
43
+ # Returns a list of signal names mapped to the corresponding underlying
44
+ # signal numbers.
45
+ #
46
+ # ```ruby
47
+ # Signal.list #=> {"EXIT"=>0, "HUP"=>1, "INT"=>2, "QUIT"=>3, "ILL"=>4, "TRAP"=>5, "IOT"=>6, "ABRT"=>6, "FPE"=>8, "KILL"=>9, "BUS"=>7, "SEGV"=>11, "SYS"=>31, "PIPE"=>13, "ALRM"=>14, "TERM"=>15, "URG"=>23, "STOP"=>19, "TSTP"=>20, "CONT"=>18, "CHLD"=>17, "CLD"=>17, "TTIN"=>21, "TTOU"=>22, "IO"=>29, "XCPU"=>24, "XFSZ"=>25, "VTALRM"=>26, "PROF"=>27, "WINCH"=>28, "USR1"=>10, "USR2"=>12, "PWR"=>30, "POLL"=>29}
48
+ # ```
49
+ def self.list: () -> ::Hash[String, Integer]
50
+
51
+ def self.signame: (Integer arg0) -> String?
52
+
53
+ def self.trap: (Integer | String | Symbol signal, ?untyped command) -> (String | Proc)
54
+ | (Integer | String | Symbol signal) { (Integer arg0) -> untyped } -> (String | Proc)
55
+ end
@@ -0,0 +1,770 @@
1
+ # A `String` object holds and manipulates an arbitrary sequence of bytes,
2
+ # typically representing characters. [String](String)
3
+ # objects may be created using `String::new` or as literals.
4
+ #
5
+ # Because of aliasing issues, users of strings should be aware of the
6
+ # methods that modify the contents of a `String` object. Typically,
7
+ # methods with names ending in “\!” modify their receiver, while those
8
+ # without a “\!” return a new `String` . However, there are exceptions,
9
+ # such as `String#[]=` .
10
+ class String < Object
11
+ include Comparable
12
+
13
+ def %: (Object arg0) -> String
14
+
15
+ def *: (Integer arg0) -> String
16
+
17
+ def +: (String arg0) -> String
18
+
19
+ def <<: (Object arg0) -> String
20
+
21
+ def <=>: (String other) -> Integer?
22
+
23
+ def ==: (untyped arg0) -> bool
24
+
25
+ def ===: (untyped arg0) -> bool
26
+
27
+ %a{rbs:test:skip}
28
+ def =~: (Object arg0) -> Integer?
29
+
30
+ def []: (Integer arg0, ?Integer arg1) -> String?
31
+ | (::Range[Integer] | Regexp arg0) -> String?
32
+ | (Regexp arg0, ?Integer arg1) -> String?
33
+ | (Regexp arg0, ?String arg1) -> String?
34
+ | (String arg0) -> String?
35
+
36
+ # Returns true for a string which has only ASCII characters.
37
+ #
38
+ # ```ruby
39
+ # "abc".force_encoding("UTF-8").ascii_only? #=> true
40
+ # "abc\u{6666}".force_encoding("UTF-8").ascii_only? #=> false
41
+ # ```
42
+ def ascii_only?: () -> bool
43
+
44
+ # Returns a copied string whose encoding is ASCII-8BIT.
45
+ def b: () -> String
46
+
47
+ # Returns an array of bytes in *str* . This is a shorthand for
48
+ # `str.each_byte.to_a` .
49
+ #
50
+ # If a block is given, which is a deprecated form, works the same as
51
+ # `each_byte` .
52
+ def bytes: () -> Array[String]
53
+
54
+ # Returns the length of `str` in bytes.
55
+ #
56
+ # "\x80\u3042".bytesize #=> 4
57
+ # "hello".bytesize #=> 5
58
+ def bytesize: () -> Integer
59
+
60
+ def byteslice: (Integer arg0, ?Integer arg1) -> String?
61
+ | (::Range[Integer] arg0) -> String?
62
+
63
+ # Returns a copy of *str* with the first character converted to uppercase
64
+ # and the remainder to lowercase.
65
+ #
66
+ # See [\#downcase](String.downloaded.ruby_doc#method-i-downcase) for
67
+ # meaning of `options` and use with different encodings.
68
+ #
69
+ # ```ruby
70
+ # "hello".capitalize #=> "Hello"
71
+ # "HELLO".capitalize #=> "Hello"
72
+ # "123ABC".capitalize #=> "123abc"
73
+ # ```
74
+ def capitalize: () -> String
75
+
76
+ # Modifies *str* by converting the first character to uppercase and the
77
+ # remainder to lowercase. Returns `nil` if no changes are made. There is
78
+ # an exception for modern Georgian (mkhedruli/MTAVRULI), where the result
79
+ # is the same as for
80
+ # [\#downcase](String.downloaded.ruby_doc#method-i-downcase), to avoid
81
+ # mixed case.
82
+ #
83
+ # See [\#downcase](String.downloaded.ruby_doc#method-i-downcase) for
84
+ # meaning of `options` and use with different encodings.
85
+ #
86
+ # ```ruby
87
+ # a = "hello"
88
+ # a.capitalize! #=> "Hello"
89
+ # a #=> "Hello"
90
+ # a.capitalize! #=> nil
91
+ # ```
92
+ def capitalize!: () -> String?
93
+
94
+ def casecmp: (String arg0) -> Integer?
95
+
96
+ def center: (Integer arg0, ?String arg1) -> String
97
+
98
+ # Returns an array of characters in *str* . This is a shorthand for
99
+ # `str.each_char.to_a` .
100
+ #
101
+ # If a block is given, which is a deprecated form, works the same as
102
+ # `each_char` .
103
+ def chars: () -> Array[String]
104
+
105
+ def chomp: (?String arg0) -> String
106
+
107
+ def chomp!: (?String arg0) -> String?
108
+
109
+ # Returns a new `String` with the last character removed. If the string
110
+ # ends with `\r\n`, both characters are removed. Applying `chop` to an
111
+ # empty string returns an empty string. `String#chomp` is often a safer
112
+ # alternative, as it leaves the string unchanged if it doesn’t end in a
113
+ # record separator.
114
+ #
115
+ # ```ruby
116
+ # "string\r\n".chop #=> "string"
117
+ # "string\n\r".chop #=> "string\n"
118
+ # "string\n".chop #=> "string"
119
+ # "string".chop #=> "strin"
120
+ # "x".chop.chop #=> ""
121
+ # ```
122
+ def chop: () -> String
123
+
124
+ # Processes *str* as for `String#chop`, returning *str* , or `nil` if
125
+ # *str* is the empty string. See also `String#chomp!` .
126
+ def chop!: () -> String?
127
+
128
+ # Returns a one-character string at the beginning of the string.
129
+ #
130
+ # ```ruby
131
+ # a = "abcde"
132
+ # a.chr #=> "a"
133
+ # ```
134
+ def chr: () -> String
135
+
136
+ # Makes string empty.
137
+ #
138
+ # ```ruby
139
+ # a = "abcde"
140
+ # a.clear #=> ""
141
+ # ```
142
+ def clear: () -> String
143
+
144
+ # Returns an array of the `Integer` ordinals of the characters in *str* .
145
+ # This is a shorthand for `str.each_codepoint.to_a` .
146
+ #
147
+ # If a block is given, which is a deprecated form, works the same as
148
+ # `each_codepoint` .
149
+ def codepoints: () -> ::Array[Integer]
150
+ | () { () -> untyped } -> ::Array[Integer]
151
+
152
+ def concat: (Integer | Object arg0) -> String
153
+
154
+ def count: (String arg0, *String arg1) -> Integer
155
+
156
+ def crypt: (String arg0) -> String
157
+
158
+ def delete: (String arg0, *String arg1) -> String
159
+
160
+ def delete!: (String arg0, *String arg1) -> String?
161
+
162
+ def delete_prefix: (String) -> String
163
+
164
+ def delete_prefix!: (String) -> String?
165
+
166
+ def delete_suffix: (String) -> String
167
+
168
+ def delete_suffix!: (String) -> String?
169
+
170
+ # Returns a copy of *str* with all uppercase letters replaced with their
171
+ # lowercase counterparts. Which letters exactly are replaced, and by which
172
+ # other letters, depends on the presence or absence of options, and on the
173
+ # `encoding` of the string.
174
+ #
175
+ # The meaning of the `options` is as follows:
176
+ #
177
+ # - No option
178
+ # Full Unicode case mapping, suitable for most languages (see :turkic
179
+ # and :lithuanian options below for exceptions). Context-dependent
180
+ # case mapping as described in Table 3-14 of the Unicode standard is
181
+ # currently not supported.
182
+ #
183
+ # - :ascii
184
+ # Only the ASCII region, i.e. the characters “A” to “Z” and “a” to
185
+ # “z”, are affected. This option cannot be combined with any other
186
+ # option.
187
+ #
188
+ # - :turkic
189
+ # Full Unicode case mapping, adapted for Turkic languages (Turkish,
190
+ # Azerbaijani, …). This means that upper case I is mapped to lower
191
+ # case dotless i, and so on.
192
+ #
193
+ # - :lithuanian
194
+ # Currently, just full Unicode case mapping. In the future, full
195
+ # Unicode case mapping adapted for Lithuanian (keeping the dot on the
196
+ # lower case i even if there is an accent on top).
197
+ #
198
+ # - :fold
199
+ # Only available on `downcase` and `downcase!` . Unicode case
200
+ # **folding** , which is more far-reaching than Unicode case mapping.
201
+ # This option currently cannot be combined with any other option (i.e.
202
+ # there is currently no variant for turkic languages).
203
+ #
204
+ # Please note that several assumptions that are valid for ASCII-only case
205
+ # conversions do not hold for more general case conversions. For example,
206
+ # the length of the result may not be the same as the length of the input
207
+ # (neither in characters nor in bytes), some roundtrip assumptions (e.g.
208
+ # str.downcase == str.upcase.downcase) may not apply, and Unicode
209
+ # normalization (i.e.
210
+ # [\#unicode\_normalize](String.downloaded.ruby_doc#method-i-unicode_normalize)
211
+ # ) is not necessarily maintained by case mapping operations.
212
+ #
213
+ # Non-ASCII case mapping/folding is currently supported for UTF-8,
214
+ # UTF-16BE/LE, UTF-32BE/LE, and ISO-8859-1\~16 Strings/Symbols. This
215
+ # support will be extended to other encodings.
216
+ #
217
+ # ```ruby
218
+ # "hEllO".downcase #=> "hello"
219
+ # ```
220
+ def downcase: () -> String
221
+
222
+ # Downcases the contents of *str* , returning `nil` if no changes were
223
+ # made.
224
+ #
225
+ # See [\#downcase](String.downloaded.ruby_doc#method-i-downcase) for
226
+ # meaning of `options` and use with different encodings.
227
+ def downcase!: () -> String?
228
+
229
+ # Produces a version of `str` with all non-printing characters replaced by
230
+ # `\nnn` notation and all special characters escaped.
231
+ #
232
+ # ```ruby
233
+ # "hello \n ''".dump #=> "\"hello \\n ''\""
234
+ # ```
235
+ def dump: () -> String
236
+
237
+ def each_byte: () { (Integer arg0) -> untyped } -> String
238
+ | () -> ::Enumerator[Integer, self]
239
+
240
+ def each_char: () { (String arg0) -> untyped } -> String
241
+ | () -> ::Enumerator[String, self]
242
+
243
+ def each_codepoint: () { (Integer arg0) -> untyped } -> String
244
+ | () -> ::Enumerator[Integer, self]
245
+
246
+ def each_line: (?String arg0) { (String arg0) -> untyped } -> String
247
+ | (?String arg0) -> ::Enumerator[String, self]
248
+
249
+ # Returns `true` if *str* has a length of zero.
250
+ #
251
+ # ```ruby
252
+ # "hello".empty? #=> false
253
+ # " ".empty? #=> false
254
+ # "".empty? #=> true
255
+ # ```
256
+ def empty?: () -> bool
257
+
258
+ # Returns the [Encoding](https://ruby-doc.org/core-2.6.3/Encoding.html)
259
+ # object that represents the encoding of obj.
260
+ def encoding: () -> Encoding
261
+
262
+ def end_with?: (*String arg0) -> bool
263
+
264
+ def eql?: (String arg0) -> bool
265
+
266
+ def force_encoding: (String | Encoding arg0) -> String
267
+
268
+ def getbyte: (Integer arg0) -> Integer?
269
+
270
+ def gsub: (Regexp | String arg0, ?String arg1) -> String
271
+ | (Regexp | String arg0, ?Hash[String, String] arg1) -> String
272
+ | (Regexp | String arg0) { (String arg0) -> untyped } -> String
273
+ | (Regexp | String arg0) -> ::Enumerator[String, self]
274
+ | (Regexp | String arg0) -> String
275
+
276
+ def gsub!: (Regexp | String arg0, ?String arg1) -> String?
277
+ | (Regexp | String arg0) { (String arg0) -> untyped } -> String?
278
+ | (Regexp | String arg0) -> ::Enumerator[String, self]
279
+
280
+ # Returns a hash based on the string’s length, content and encoding.
281
+ #
282
+ # See also Object\#hash.
283
+ def hash: () -> Integer
284
+
285
+ # Treats leading characters from *str* as a string of hexadecimal digits
286
+ # (with an optional sign and an optional `0x` ) and returns the
287
+ # corresponding number. Zero is returned on error.
288
+ #
289
+ # ```ruby
290
+ # "0x0a".hex #=> 10
291
+ # "-1234".hex #=> -4660
292
+ # "0".hex #=> 0
293
+ # "wombat".hex #=> 0
294
+ # ```
295
+ def hex: () -> Integer
296
+
297
+ def `include?`: (String arg0) -> bool
298
+
299
+ def index: (Regexp | String arg0, ?Integer arg1) -> Integer?
300
+
301
+ def initialize: (?String str, ?encoding: Encoding | String, ?capacity: Integer) -> void
302
+
303
+ def insert: (Integer arg0, String arg1) -> String
304
+
305
+ # Returns a printable version of *str* , surrounded by quote marks, with
306
+ # special characters escaped.
307
+ #
308
+ # ```ruby
309
+ # str = "hello"
310
+ # str[3] = "\b"
311
+ # str.inspect #=> "\"hel\\bo\""
312
+ # ```
313
+ def inspect: () -> String
314
+
315
+ # Returns the `Symbol` corresponding to *str* , creating the symbol if it
316
+ # did not previously exist. See `Symbol#id2name` .
317
+ #
318
+ # ```ruby
319
+ # "Koala".intern #=> :Koala
320
+ # s = 'cat'.to_sym #=> :cat
321
+ # s == :cat #=> true
322
+ # s = '@cat'.to_sym #=> :@cat
323
+ # s == :@cat #=> true
324
+ # ```
325
+ #
326
+ # This can also be used to create symbols that cannot be represented using
327
+ # the `:xxx` notation.
328
+ #
329
+ # ```ruby
330
+ # 'cat and dog'.to_sym #=> :"cat and dog"
331
+ # ```
332
+ def intern: () -> Symbol
333
+
334
+ # Returns the character length of *str* .
335
+ def length: () -> Integer
336
+
337
+ def lines: (?String arg0) -> ::Array[String]
338
+
339
+ def ljust: (Integer arg0, ?String arg1) -> String
340
+
341
+ # Returns a copy of the receiver with leading whitespace removed. See also
342
+ # [\#rstrip](String.downloaded.ruby_doc#method-i-rstrip) and
343
+ # [\#strip](String.downloaded.ruby_doc#method-i-strip).
344
+ #
345
+ # Refer to [\#strip](String.downloaded.ruby_doc#method-i-strip) for the
346
+ # definition of whitespace.
347
+ #
348
+ # ```ruby
349
+ # " hello ".lstrip #=> "hello "
350
+ # "hello".lstrip #=> "hello"
351
+ # ```
352
+ def lstrip: () -> String
353
+
354
+ # Removes leading whitespace from the receiver. Returns the altered
355
+ # receiver, or `nil` if no change was made. See also
356
+ # [\#rstrip\!](String.downloaded.ruby_doc#method-i-rstrip-21) and
357
+ # [\#strip\!](String.downloaded.ruby_doc#method-i-strip-21).
358
+ #
359
+ # Refer to [\#strip](String.downloaded.ruby_doc#method-i-strip) for the
360
+ # definition of whitespace.
361
+ #
362
+ # ```ruby
363
+ # " hello ".lstrip! #=> "hello "
364
+ # "hello ".lstrip! #=> nil
365
+ # "hello".lstrip! #=> nil
366
+ # ```
367
+ def lstrip!: () -> String?
368
+
369
+ def match: (Regexp | String arg0) -> MatchData?
370
+ | (Regexp | String arg0, ?Integer arg1) -> MatchData?
371
+
372
+ def match?: (Regexp | String arg0) -> bool
373
+ | (Regexp | String arg0, ?Integer arg1) -> bool
374
+
375
+ # Returns the successor to *str* . The successor is calculated by
376
+ # incrementing characters starting from the rightmost alphanumeric (or the
377
+ # rightmost character if there are no alphanumerics) in the string.
378
+ # Incrementing a digit always results in another digit, and incrementing a
379
+ # letter results in another letter of the same case. Incrementing
380
+ # nonalphanumerics uses the underlying character set’s collating sequence.
381
+ #
382
+ # If the increment generates a “carry,” the character to the left of it is
383
+ # incremented. This process repeats until there is no carry, adding an
384
+ # additional character if necessary.
385
+ #
386
+ # ```ruby
387
+ # "abcd".succ #=> "abce"
388
+ # "THX1138".succ #=> "THX1139"
389
+ # "<<koala>>".succ #=> "<<koalb>>"
390
+ # "1999zzz".succ #=> "2000aaa"
391
+ # "ZZZ9999".succ #=> "AAAA0000"
392
+ # "***".succ #=> "**+"
393
+ # ```
394
+ def next: () -> String
395
+
396
+ # Equivalent to `String#succ`, but modifies the receiver in place.
397
+ def next!: () -> String
398
+
399
+ # Treats leading characters of *str* as a string of octal digits (with an
400
+ # optional sign) and returns the corresponding number. Returns 0 if the
401
+ # conversion fails.
402
+ #
403
+ # ```ruby
404
+ # "123".oct #=> 83
405
+ # "-377".oct #=> -255
406
+ # "bad".oct #=> 0
407
+ # "0377bad".oct #=> 255
408
+ # ```
409
+ #
410
+ # If `str` starts with `0`, radix indicators are honored. See
411
+ # Kernel\#Integer.
412
+ def oct: () -> Integer
413
+
414
+ # Returns the `Integer` ordinal of a one-character string.
415
+ #
416
+ # ```ruby
417
+ # "a".ord #=> 97
418
+ # ```
419
+ def ord: () -> Integer
420
+
421
+ def partition: (Regexp | String arg0) -> [ String, String, String ]
422
+
423
+ def `prepend`: (String arg0) -> String
424
+
425
+ def replace: (String arg0) -> String
426
+
427
+ # Returns a new string with the characters from *str* in reverse order.
428
+ #
429
+ # ```ruby
430
+ # "stressed".reverse #=> "desserts"
431
+ # ```
432
+ def reverse: () -> String
433
+
434
+ def rindex: (String | Regexp arg0, ?Integer arg1) -> Integer?
435
+
436
+ def rjust: (Integer arg0, ?String arg1) -> String
437
+
438
+ def rpartition: (String | Regexp arg0) -> [ String, String, String ]
439
+
440
+ # Returns a copy of the receiver with trailing whitespace removed. See
441
+ # also [\#lstrip](String.downloaded.ruby_doc#method-i-lstrip) and
442
+ # [\#strip](String.downloaded.ruby_doc#method-i-strip).
443
+ #
444
+ # Refer to [\#strip](String.downloaded.ruby_doc#method-i-strip) for the
445
+ # definition of whitespace.
446
+ #
447
+ # ```ruby
448
+ # " hello ".rstrip #=> " hello"
449
+ # "hello".rstrip #=> "hello"
450
+ # ```
451
+ def rstrip: () -> String
452
+
453
+ # Removes trailing whitespace from the receiver. Returns the altered
454
+ # receiver, or `nil` if no change was made. See also
455
+ # [\#lstrip\!](String.downloaded.ruby_doc#method-i-lstrip-21) and
456
+ # [\#strip\!](String.downloaded.ruby_doc#method-i-strip-21).
457
+ #
458
+ # Refer to [\#strip](String.downloaded.ruby_doc#method-i-strip) for the
459
+ # definition of whitespace.
460
+ #
461
+ # ```ruby
462
+ # " hello ".rstrip! #=> " hello"
463
+ # " hello".rstrip! #=> nil
464
+ # "hello".rstrip! #=> nil
465
+ # ```
466
+ def rstrip!: () -> String
467
+
468
+ def scan: (Regexp | String arg0) -> ::Array[String | ::Array[String]]
469
+ | (Regexp | String arg0) { () -> untyped } -> ::Array[String | ::Array[String]]
470
+
471
+ def scrub: (?String arg0) -> String
472
+ | (?String arg0) { (untyped arg0) -> untyped } -> String
473
+
474
+ def scrub!: (?String arg0) -> String
475
+ | (?String arg0) { (untyped arg0) -> untyped } -> String
476
+
477
+ def setbyte: (Integer arg0, Integer arg1) -> Integer
478
+
479
+ # Returns the character length of *str* .
480
+ def size: () -> Integer
481
+
482
+ def slice!: (Integer arg0, ?Integer arg1) -> String?
483
+ | (::Range[Integer] | Regexp arg0) -> String?
484
+ | (Regexp arg0, ?Integer arg1) -> String?
485
+ | (Regexp arg0, ?String arg1) -> String?
486
+ | (String arg0) -> String?
487
+
488
+ def split: (?Regexp | String arg0, ?Integer arg1) -> ::Array[String]
489
+ | (?Integer arg0) -> ::Array[String]
490
+
491
+ def squeeze: (?String arg0) -> String
492
+
493
+ def squeeze!: (?String arg0) -> String
494
+
495
+ def start_with?: (*String arg0) -> bool
496
+
497
+ # Returns a copy of the receiver with leading and trailing whitespace
498
+ # removed.
499
+ #
500
+ # Whitespace is defined as any of the following characters: null,
501
+ # horizontal tab, line feed, vertical tab, form feed, carriage return,
502
+ # space.
503
+ #
504
+ # ```ruby
505
+ # " hello ".strip #=> "hello"
506
+ # "\tgoodbye\r\n".strip #=> "goodbye"
507
+ # "\x00\t\n\v\f\r ".strip #=> ""
508
+ # "hello".strip #=> "hello"
509
+ # ```
510
+ def strip: () -> String
511
+
512
+ # Removes leading and trailing whitespace from the receiver. Returns the
513
+ # altered receiver, or `nil` if there was no change.
514
+ #
515
+ # Refer to [\#strip](String.downloaded.ruby_doc#method-i-strip) for the
516
+ # definition of whitespace.
517
+ #
518
+ # ```ruby
519
+ # " hello ".strip! #=> "hello"
520
+ # "hello".strip! #=> nil
521
+ # ```
522
+ def strip!: () -> String
523
+
524
+ def sub: (Regexp | String arg0, ?String | Hash[String, String] arg1) -> String
525
+ | (Regexp | String arg0) { (String arg0) -> untyped } -> String
526
+
527
+ def sub!: (Regexp | String arg0, ?String arg1) -> String
528
+ | (Regexp | String arg0) { (String arg0) -> untyped } -> String
529
+
530
+ # Returns the successor to *str* . The successor is calculated by
531
+ # incrementing characters starting from the rightmost alphanumeric (or the
532
+ # rightmost character if there are no alphanumerics) in the string.
533
+ # Incrementing a digit always results in another digit, and incrementing a
534
+ # letter results in another letter of the same case. Incrementing
535
+ # nonalphanumerics uses the underlying character set’s collating sequence.
536
+ #
537
+ # If the increment generates a “carry,” the character to the left of it is
538
+ # incremented. This process repeats until there is no carry, adding an
539
+ # additional character if necessary.
540
+ #
541
+ # ```ruby
542
+ # "abcd".succ #=> "abce"
543
+ # "THX1138".succ #=> "THX1139"
544
+ # "<<koala>>".succ #=> "<<koalb>>"
545
+ # "1999zzz".succ #=> "2000aaa"
546
+ # "ZZZ9999".succ #=> "AAAA0000"
547
+ # "***".succ #=> "**+"
548
+ # ```
549
+ def succ: () -> String
550
+
551
+ def succ!: () -> String
552
+
553
+ def sum: (?Integer arg0) -> Integer
554
+
555
+ # Returns a copy of *str* with uppercase alphabetic characters converted
556
+ # to lowercase and lowercase characters converted to uppercase.
557
+ #
558
+ # See [\#downcase](String.downloaded.ruby_doc#method-i-downcase) for
559
+ # meaning of `options` and use with different encodings.
560
+ #
561
+ # ```ruby
562
+ # "Hello".swapcase #=> "hELLO"
563
+ # "cYbEr_PuNk11".swapcase #=> "CyBeR_pUnK11"
564
+ # ```
565
+ def swapcase: () -> String
566
+
567
+ # Equivalent to `String#swapcase`, but modifies the receiver in place,
568
+ # returning *str* , or `nil` if no changes were made.
569
+ #
570
+ # See [\#downcase](String.downloaded.ruby_doc#method-i-downcase) for
571
+ # meaning of `options` and use with different encodings.
572
+ def swapcase!: () -> String?
573
+
574
+ # Returns a complex which denotes the string form. The parser ignores
575
+ # leading whitespaces and trailing garbage. Any digit sequences can be
576
+ # separated by an underscore. Returns zero for null or garbage string.
577
+ #
578
+ # ```ruby
579
+ # '9'.to_c #=> (9+0i)
580
+ # '2.5'.to_c #=> (2.5+0i)
581
+ # '2.5/1'.to_c #=> ((5/2)+0i)
582
+ # '-3/2'.to_c #=> ((-3/2)+0i)
583
+ # '-i'.to_c #=> (0-1i)
584
+ # '45i'.to_c #=> (0+45i)
585
+ # '3-4i'.to_c #=> (3-4i)
586
+ # '-4e2-4e-2i'.to_c #=> (-400.0-0.04i)
587
+ # '-0.0-0.0i'.to_c #=> (-0.0-0.0i)
588
+ # '1/2+3/4i'.to_c #=> ((1/2)+(3/4)*i)
589
+ # 'ruby'.to_c #=> (0+0i)
590
+ # ```
591
+ #
592
+ # See [Kernel](https://ruby-doc.org/core-2.6.3/Kernel.html).Complex.
593
+ def to_c: () -> Complex
594
+
595
+ # Returns the result of interpreting leading characters in *str* as a
596
+ # floating point number. Extraneous characters past the end of a valid
597
+ # number are ignored. If there is not a valid number at the start of *str*
598
+ # , `0.0` is returned. This method never raises an exception.
599
+ #
600
+ # ```ruby
601
+ # "123.45e1".to_f #=> 1234.5
602
+ # "45.67 degrees".to_f #=> 45.67
603
+ # "thx1138".to_f #=> 0.0
604
+ # ```
605
+ def to_f: () -> Float
606
+
607
+ def to_i: (?Integer arg0) -> Integer
608
+
609
+ # Returns the result of interpreting leading characters in `str` as a
610
+ # rational. Leading whitespace and extraneous characters past the end of a
611
+ # valid number are ignored. Digit sequences can be separated by an
612
+ # underscore. If there is not a valid number at the start of `str`, zero
613
+ # is returned. This method never raises an exception.
614
+ #
615
+ # ```ruby
616
+ # ' 2 '.to_r #=> (2/1)
617
+ # '300/2'.to_r #=> (150/1)
618
+ # '-9.2'.to_r #=> (-46/5)
619
+ # '-9.2e2'.to_r #=> (-920/1)
620
+ # '1_234_567'.to_r #=> (1234567/1)
621
+ # '21 June 09'.to_r #=> (21/1)
622
+ # '21/06/09'.to_r #=> (7/2)
623
+ # 'BWV 1079'.to_r #=> (0/1)
624
+ # ```
625
+ #
626
+ # NOTE: “0.3”.to\_r isn’t the same as 0.3.to\_r. The former is equivalent
627
+ # to “3/10”.to\_r, but the latter isn’t so.
628
+ #
629
+ # "0.3".to_r == 3/10r #=> true
630
+ # 0.3.to_r == 3/10r #=> false
631
+ #
632
+ # See also Kernel\#Rational.
633
+ def to_r: () -> Rational
634
+
635
+ # Returns `self` .
636
+ #
637
+ # If called on a subclass of [String](String.downloaded.ruby_doc),
638
+ # converts the receiver to a [String](String.downloaded.ruby_doc) object.
639
+ def to_s: () -> String
640
+
641
+ # Returns `self` .
642
+ #
643
+ # If called on a subclass of [String](String.downloaded.ruby_doc),
644
+ # converts the receiver to a [String](String.downloaded.ruby_doc) object.
645
+ def to_str: () -> String
646
+
647
+ # Returns the `Symbol` corresponding to *str* , creating the symbol if it
648
+ # did not previously exist. See `Symbol#id2name` .
649
+ #
650
+ # ```ruby
651
+ # "Koala".intern #=> :Koala
652
+ # s = 'cat'.to_sym #=> :cat
653
+ # s == :cat #=> true
654
+ # s = '@cat'.to_sym #=> :@cat
655
+ # s == :@cat #=> true
656
+ # ```
657
+ #
658
+ # This can also be used to create symbols that cannot be represented using
659
+ # the `:xxx` notation.
660
+ #
661
+ # ```ruby
662
+ # 'cat and dog'.to_sym #=> :"cat and dog"
663
+ # ```
664
+ def to_sym: () -> Symbol
665
+
666
+ def tr: (String arg0, String arg1) -> String
667
+
668
+ def tr!: (String arg0, String arg1) -> String?
669
+
670
+ def tr_s: (String arg0, String arg1) -> String
671
+
672
+ def tr_s!: (String arg0, String arg1) -> String?
673
+
674
+ def unpack: (String arg0) -> ::Array[(Integer | Float | String)?]
675
+
676
+ # Returns a copy of *str* with all lowercase letters replaced with their
677
+ # uppercase counterparts.
678
+ #
679
+ # See [\#downcase](String.downloaded.ruby_doc#method-i-downcase) for
680
+ # meaning of `options` and use with different encodings.
681
+ #
682
+ # ```ruby
683
+ # "hEllO".upcase #=> "HELLO"
684
+ # ```
685
+ def upcase: () -> String
686
+
687
+ # Upcases the contents of *str* , returning `nil` if no changes were made.
688
+ #
689
+ # See [\#downcase](String.downloaded.ruby_doc#method-i-downcase) for
690
+ # meaning of `options` and use with different encodings.
691
+ def upcase!: () -> String?
692
+
693
+ def upto: [Bool] (String arg0, ?Bool arg1) -> ::Enumerator[String, self]
694
+ | [Bool] (String arg0, ?Bool arg1) { (String arg0) -> untyped } -> String
695
+
696
+ # Returns true for a string which is encoded correctly.
697
+ #
698
+ # ```ruby
699
+ # "\xc2\xa1".force_encoding("UTF-8").valid_encoding? #=> true
700
+ # "\xc2".force_encoding("UTF-8").valid_encoding? #=> false
701
+ # "\x80".force_encoding("UTF-8").valid_encoding? #=> false
702
+ # ```
703
+ def valid_encoding?: () -> bool
704
+
705
+ def self.try_convert: (Object obj) -> String?
706
+
707
+ def slice: (Integer arg0, ?Integer arg1) -> String?
708
+ | (::Range[Integer] | Regexp arg0) -> String?
709
+ | (Regexp arg0, ?Integer arg1) -> String?
710
+ | (Regexp arg0, ?String arg1) -> String?
711
+ | (String arg0) -> String?
712
+
713
+ def encode: (
714
+ ?(Encoding | String) encoding,
715
+ ?(Encoding | String) from_encoding,
716
+ ?invalid: :replace ?,
717
+ ?undef: :replace ?,
718
+ ?replace: String,
719
+ ?fallback: Hash[String, String] | Proc | Method,
720
+ ?xml: :text | :attr,
721
+ ?universal_newline: TrueClass,
722
+ ?cr_newline: TrueClass,
723
+ ?crlf_newline: TrueClass
724
+ ) -> String
725
+
726
+ def encode!: (
727
+ ?(Encoding | String) encoding,
728
+ ?(Encoding | String) from_encoding,
729
+ ?invalid: :replace ?,
730
+ ?undef: :replace ?,
731
+ ?replace: String,
732
+ ?fallback: Hash[String, String] | Proc | Method,
733
+ ?xml: :text | :attr,
734
+ ?universal_newline: TrueClass,
735
+ ?cr_newline: TrueClass,
736
+ ?crlf_newline: TrueClass
737
+ ) -> self
738
+
739
+ def +@: () -> String
740
+
741
+ def -@: () -> String
742
+
743
+ def unicode_normalize: (?(:nfc | :nfd | :nfkc | :nfkd)) -> String
744
+
745
+ def unicode_normalize!: (?(:nfc | :nfd | :nfkc | :nfkd)) -> String
746
+
747
+ def casecmp?: (String other) -> bool
748
+ | (untyped other) -> nil
749
+
750
+ def []=: (Integer pos, String new_str) -> String
751
+ | (Integer begin_pos, Integer end_pos, String new_str) -> String
752
+ | (::Range[Integer] range, String new_str) -> String
753
+ | (Regexp regexp, String new_str) -> String
754
+ | (Regexp regexp, Integer capture, String new_str) -> String
755
+ | (Regexp regexp, String name, String new_str) -> String
756
+ | (String other_str, String new_str) -> String
757
+
758
+ def undump: () -> String
759
+
760
+ def grapheme_clusters: () -> ::Array[::String]
761
+
762
+ def reverse!: () -> String
763
+
764
+ def each_grapheme_cluster: () { (String grapheme) -> untyped } -> self
765
+ | () -> ::Enumerator[String, self]
766
+
767
+ def unpack1: (String format) -> (Integer | Float | String | nil)
768
+
769
+ def unicode_normalized?: (?(:nfc | :nfd | :nfkc | :nfkd)) -> bool
770
+ end