steep 0.11.1 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
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,606 @@
1
+ class Encoding < Object
2
+ # Returns the hash of available encoding alias and original encoding name.
3
+ #
4
+ # Encoding.aliases
5
+ # #=> {"BINARY"=>"ASCII-8BIT", "ASCII"=>"US-ASCII", "ANSI_X3.4-1986"=>"US-ASCII",
6
+ # "SJIS"=>"Shift_JIS", "eucJP"=>"EUC-JP", "CP932"=>"Windows-31J"}
7
+ def self.aliases: () -> ::Hash[String, String]
8
+
9
+ def self.compatible?: (untyped obj1, untyped obj2) -> Encoding?
10
+
11
+ # Returns default external encoding.
12
+ #
13
+ # The default external encoding is used by default for strings created
14
+ # from the following locations:
15
+ #
16
+ # - CSV
17
+ #
18
+ # - [File](https://ruby-doc.org/core-2.6.3/File.html) data read from
19
+ # disk
20
+ #
21
+ # - SDBM
22
+ #
23
+ # - StringIO
24
+ #
25
+ # - Zlib::GzipReader
26
+ #
27
+ # - Zlib::GzipWriter
28
+ #
29
+ # - [String\#inspect](https://ruby-doc.org/core-2.6.3/String.html#method-i-inspect)
30
+ #
31
+ # - [Regexp\#inspect](https://ruby-doc.org/core-2.6.3/Regexp.html#method-i-inspect)
32
+ #
33
+ # While strings created from these locations will have this encoding, the
34
+ # encoding may not be valid. Be sure to check
35
+ # [String\#valid\_encoding?](https://ruby-doc.org/core-2.6.3/String.html#method-i-valid_encoding-3F)
36
+ # .
37
+ #
38
+ # [File](https://ruby-doc.org/core-2.6.3/File.html) data written to disk
39
+ # will be transcoded to the default external encoding when written.
40
+ #
41
+ # The default external encoding is initialized by the locale or -E option.
42
+ def self.default_external: () -> Encoding
43
+
44
+ def self.default_external=: (String arg0) -> String
45
+ | (Encoding arg0) -> Encoding
46
+
47
+ # Returns default internal encoding. Strings will be transcoded to the
48
+ # default internal encoding in the following places if the default
49
+ # internal encoding is not nil:
50
+ #
51
+ # - CSV
52
+ #
53
+ # - Etc.sysconfdir and Etc.systmpdir
54
+ #
55
+ # - [File](https://ruby-doc.org/core-2.6.3/File.html) data read from
56
+ # disk
57
+ #
58
+ # - [File](https://ruby-doc.org/core-2.6.3/File.html) names from
59
+ # [Dir](https://ruby-doc.org/core-2.6.3/Dir.html)
60
+ #
61
+ # - [Integer\#chr](https://ruby-doc.org/core-2.6.3/Integer.html#method-i-chr)
62
+ #
63
+ # - [String\#inspect](https://ruby-doc.org/core-2.6.3/String.html#method-i-inspect)
64
+ # and
65
+ # [Regexp\#inspect](https://ruby-doc.org/core-2.6.3/Regexp.html#method-i-inspect)
66
+ #
67
+ # - Strings returned from Readline
68
+ #
69
+ # - Strings returned from SDBM
70
+ #
71
+ # - [Time\#zone](https://ruby-doc.org/core-2.6.3/Time.html#method-i-zone)
72
+ #
73
+ # - Values from [ENV](https://ruby-doc.org/core-2.6.3/ENV.html)
74
+ #
75
+ # - Values in ARGV including $PROGRAM\_NAME
76
+ #
77
+ # Additionally
78
+ # [String\#encode](https://ruby-doc.org/core-2.6.3/String.html#method-i-encode)
79
+ # and
80
+ # [String\#encode\!](https://ruby-doc.org/core-2.6.3/String.html#method-i-encode-21)
81
+ # use the default internal encoding if no encoding is given.
82
+ #
83
+ # The locale encoding (\_\_ENCODING\_\_), not
84
+ # [::default\_internal](Encoding.downloaded.ruby_doc#method-c-default_internal)
85
+ # , is used as the encoding of created strings.
86
+ #
87
+ # [::default\_internal](Encoding.downloaded.ruby_doc#method-c-default_internal)
88
+ # is initialized by the source file's internal\_encoding or -E option.
89
+ def self.default_internal: () -> Encoding
90
+
91
+ def self.default_internal=: (String arg0) -> String?
92
+ | (Encoding arg0) -> Encoding?
93
+
94
+ def self.find: (String | Encoding arg0) -> Encoding
95
+
96
+ def self.list: () -> ::Array[Encoding]
97
+
98
+ # Returns the list of available encoding names.
99
+ #
100
+ # Encoding.name_list
101
+ # #=> ["US-ASCII", "ASCII-8BIT", "UTF-8",
102
+ # "ISO-8859-1", "Shift_JIS", "EUC-JP",
103
+ # "Windows-31J",
104
+ # "BINARY", "CP932", "eucJP"]
105
+ def self.name_list: () -> ::Array[String]
106
+
107
+ # Returns whether ASCII-compatible or not.
108
+ #
109
+ # ```ruby
110
+ # Encoding::UTF_8.ascii_compatible? #=> true
111
+ # Encoding::UTF_16BE.ascii_compatible? #=> false
112
+ # ```
113
+ def ascii_compatible?: () -> bool
114
+
115
+ # Returns true for dummy encodings. A dummy encoding is an encoding for
116
+ # which character handling is not properly implemented. It is used for
117
+ # stateful encodings.
118
+ #
119
+ # ```ruby
120
+ # Encoding::ISO_2022_JP.dummy? #=> true
121
+ # Encoding::UTF_8.dummy? #=> false
122
+ # ```
123
+ def dummy?: () -> bool
124
+
125
+ def inspect: () -> String
126
+
127
+ # Returns the name of the encoding.
128
+ #
129
+ # ```ruby
130
+ # Encoding::UTF_8.name #=> "UTF-8"
131
+ # ```
132
+ def name: () -> String
133
+
134
+ # Returns the list of name and aliases of the encoding.
135
+ #
136
+ # ```ruby
137
+ # Encoding::WINDOWS_31J.names #=> ["Windows-31J", "CP932", "csWindows31J"]
138
+ # ```
139
+ def names: () -> ::Array[String]
140
+
141
+ def replicate: (String name) -> Encoding
142
+
143
+ # Returns the name of the encoding.
144
+ #
145
+ # ```ruby
146
+ # Encoding::UTF_8.name #=> "UTF-8"
147
+ # ```
148
+ def to_s: () -> String
149
+ end
150
+
151
+ Encoding::ANSI_X3_4_1968: Encoding
152
+
153
+ Encoding::ASCII: Encoding
154
+
155
+ Encoding::ASCII_8BIT: Encoding
156
+
157
+ Encoding::BIG5: Encoding
158
+
159
+ Encoding::BIG5_HKSCS: Encoding
160
+
161
+ Encoding::BIG5_HKSCS_2008: Encoding
162
+
163
+ Encoding::BIG5_UAO: Encoding
164
+
165
+ Encoding::BINARY: Encoding
166
+
167
+ Encoding::Big5: Encoding
168
+
169
+ Encoding::Big5_HKSCS: Encoding
170
+
171
+ Encoding::Big5_HKSCS_2008: Encoding
172
+
173
+ Encoding::Big5_UAO: Encoding
174
+
175
+ Encoding::CP1250: Encoding
176
+
177
+ Encoding::CP1251: Encoding
178
+
179
+ Encoding::CP1252: Encoding
180
+
181
+ Encoding::CP1253: Encoding
182
+
183
+ Encoding::CP1254: Encoding
184
+
185
+ Encoding::CP1255: Encoding
186
+
187
+ Encoding::CP1256: Encoding
188
+
189
+ Encoding::CP1257: Encoding
190
+
191
+ Encoding::CP1258: Encoding
192
+
193
+ Encoding::CP437: Encoding
194
+
195
+ Encoding::CP50220: Encoding
196
+
197
+ Encoding::CP50221: Encoding
198
+
199
+ Encoding::CP51932: Encoding
200
+
201
+ Encoding::CP65000: Encoding
202
+
203
+ Encoding::CP65001: Encoding
204
+
205
+ Encoding::CP737: Encoding
206
+
207
+ Encoding::CP775: Encoding
208
+
209
+ Encoding::CP850: Encoding
210
+
211
+ Encoding::CP852: Encoding
212
+
213
+ Encoding::CP855: Encoding
214
+
215
+ Encoding::CP857: Encoding
216
+
217
+ Encoding::CP860: Encoding
218
+
219
+ Encoding::CP861: Encoding
220
+
221
+ Encoding::CP862: Encoding
222
+
223
+ Encoding::CP863: Encoding
224
+
225
+ Encoding::CP864: Encoding
226
+
227
+ Encoding::CP865: Encoding
228
+
229
+ Encoding::CP866: Encoding
230
+
231
+ Encoding::CP869: Encoding
232
+
233
+ Encoding::CP874: Encoding
234
+
235
+ Encoding::CP878: Encoding
236
+
237
+ Encoding::CP932: Encoding
238
+
239
+ Encoding::CP936: Encoding
240
+
241
+ Encoding::CP949: Encoding
242
+
243
+ Encoding::CP950: Encoding
244
+
245
+ Encoding::CP951: Encoding
246
+
247
+ Encoding::CSWINDOWS31J: Encoding
248
+
249
+ Encoding::CsWindows31J: Encoding
250
+
251
+ Encoding::EBCDIC_CP_US: Encoding
252
+
253
+ Encoding::EMACS_MULE: Encoding
254
+
255
+ Encoding::EUCCN: Encoding
256
+
257
+ Encoding::EUCJP: Encoding
258
+
259
+ Encoding::EUCJP_MS: Encoding
260
+
261
+ Encoding::EUCKR: Encoding
262
+
263
+ Encoding::EUCTW: Encoding
264
+
265
+ Encoding::EUC_CN: Encoding
266
+
267
+ Encoding::EUC_JISX0213: Encoding
268
+
269
+ Encoding::EUC_JIS_2004: Encoding
270
+
271
+ Encoding::EUC_JP: Encoding
272
+
273
+ Encoding::EUC_JP_MS: Encoding
274
+
275
+ Encoding::EUC_KR: Encoding
276
+
277
+ Encoding::EUC_TW: Encoding
278
+
279
+ Encoding::Emacs_Mule: Encoding
280
+
281
+ Encoding::EucCN: Encoding
282
+
283
+ Encoding::EucJP: Encoding
284
+
285
+ Encoding::EucJP_ms: Encoding
286
+
287
+ Encoding::EucKR: Encoding
288
+
289
+ Encoding::EucTW: Encoding
290
+
291
+ Encoding::GB12345: Encoding
292
+
293
+ Encoding::GB18030: Encoding
294
+
295
+ Encoding::GB1988: Encoding
296
+
297
+ Encoding::GB2312: Encoding
298
+
299
+ Encoding::GBK: Encoding
300
+
301
+ Encoding::IBM037: Encoding
302
+
303
+ Encoding::IBM437: Encoding
304
+
305
+ Encoding::IBM737: Encoding
306
+
307
+ Encoding::IBM775: Encoding
308
+
309
+ Encoding::IBM850: Encoding
310
+
311
+ Encoding::IBM852: Encoding
312
+
313
+ Encoding::IBM855: Encoding
314
+
315
+ Encoding::IBM857: Encoding
316
+
317
+ Encoding::IBM860: Encoding
318
+
319
+ Encoding::IBM861: Encoding
320
+
321
+ Encoding::IBM862: Encoding
322
+
323
+ Encoding::IBM863: Encoding
324
+
325
+ Encoding::IBM864: Encoding
326
+
327
+ Encoding::IBM865: Encoding
328
+
329
+ Encoding::IBM866: Encoding
330
+
331
+ Encoding::IBM869: Encoding
332
+
333
+ Encoding::ISO2022_JP: Encoding
334
+
335
+ Encoding::ISO2022_JP2: Encoding
336
+
337
+ Encoding::ISO8859_1: Encoding
338
+
339
+ Encoding::ISO8859_10: Encoding
340
+
341
+ Encoding::ISO8859_11: Encoding
342
+
343
+ Encoding::ISO8859_13: Encoding
344
+
345
+ Encoding::ISO8859_14: Encoding
346
+
347
+ Encoding::ISO8859_15: Encoding
348
+
349
+ Encoding::ISO8859_16: Encoding
350
+
351
+ Encoding::ISO8859_2: Encoding
352
+
353
+ Encoding::ISO8859_3: Encoding
354
+
355
+ Encoding::ISO8859_4: Encoding
356
+
357
+ Encoding::ISO8859_5: Encoding
358
+
359
+ Encoding::ISO8859_6: Encoding
360
+
361
+ Encoding::ISO8859_7: Encoding
362
+
363
+ Encoding::ISO8859_8: Encoding
364
+
365
+ Encoding::ISO8859_9: Encoding
366
+
367
+ Encoding::ISO_2022_JP: Encoding
368
+
369
+ Encoding::ISO_2022_JP_2: Encoding
370
+
371
+ Encoding::ISO_2022_JP_KDDI: Encoding
372
+
373
+ Encoding::ISO_8859_1: Encoding
374
+
375
+ Encoding::ISO_8859_10: Encoding
376
+
377
+ Encoding::ISO_8859_11: Encoding
378
+
379
+ Encoding::ISO_8859_13: Encoding
380
+
381
+ Encoding::ISO_8859_14: Encoding
382
+
383
+ Encoding::ISO_8859_15: Encoding
384
+
385
+ Encoding::ISO_8859_16: Encoding
386
+
387
+ Encoding::ISO_8859_2: Encoding
388
+
389
+ Encoding::ISO_8859_3: Encoding
390
+
391
+ Encoding::ISO_8859_4: Encoding
392
+
393
+ Encoding::ISO_8859_5: Encoding
394
+
395
+ Encoding::ISO_8859_6: Encoding
396
+
397
+ Encoding::ISO_8859_7: Encoding
398
+
399
+ Encoding::ISO_8859_8: Encoding
400
+
401
+ Encoding::ISO_8859_9: Encoding
402
+
403
+ Encoding::KOI8_R: Encoding
404
+
405
+ Encoding::KOI8_U: Encoding
406
+
407
+ Encoding::MACCENTEURO: Encoding
408
+
409
+ Encoding::MACCROATIAN: Encoding
410
+
411
+ Encoding::MACCYRILLIC: Encoding
412
+
413
+ Encoding::MACGREEK: Encoding
414
+
415
+ Encoding::MACICELAND: Encoding
416
+
417
+ Encoding::MACJAPAN: Encoding
418
+
419
+ Encoding::MACJAPANESE: Encoding
420
+
421
+ Encoding::MACROMAN: Encoding
422
+
423
+ Encoding::MACROMANIA: Encoding
424
+
425
+ Encoding::MACTHAI: Encoding
426
+
427
+ Encoding::MACTURKISH: Encoding
428
+
429
+ Encoding::MACUKRAINE: Encoding
430
+
431
+ Encoding::MacCentEuro: Encoding
432
+
433
+ Encoding::MacCroatian: Encoding
434
+
435
+ Encoding::MacCyrillic: Encoding
436
+
437
+ Encoding::MacGreek: Encoding
438
+
439
+ Encoding::MacIceland: Encoding
440
+
441
+ Encoding::MacJapan: Encoding
442
+
443
+ Encoding::MacJapanese: Encoding
444
+
445
+ Encoding::MacRoman: Encoding
446
+
447
+ Encoding::MacRomania: Encoding
448
+
449
+ Encoding::MacThai: Encoding
450
+
451
+ Encoding::MacTurkish: Encoding
452
+
453
+ Encoding::MacUkraine: Encoding
454
+
455
+ Encoding::PCK: Encoding
456
+
457
+ Encoding::SHIFT_JIS: Encoding
458
+
459
+ Encoding::SJIS: Encoding
460
+
461
+ Encoding::SJIS_DOCOMO: Encoding
462
+
463
+ Encoding::SJIS_DoCoMo: Encoding
464
+
465
+ Encoding::SJIS_KDDI: Encoding
466
+
467
+ Encoding::SJIS_SOFTBANK: Encoding
468
+
469
+ Encoding::SJIS_SoftBank: Encoding
470
+
471
+ Encoding::STATELESS_ISO_2022_JP: Encoding
472
+
473
+ Encoding::STATELESS_ISO_2022_JP_KDDI: Encoding
474
+
475
+ Encoding::Shift_JIS: Encoding
476
+
477
+ Encoding::Stateless_ISO_2022_JP: Encoding
478
+
479
+ Encoding::Stateless_ISO_2022_JP_KDDI: Encoding
480
+
481
+ Encoding::TIS_620: Encoding
482
+
483
+ Encoding::UCS_2BE: Encoding
484
+
485
+ Encoding::UCS_4BE: Encoding
486
+
487
+ Encoding::UCS_4LE: Encoding
488
+
489
+ Encoding::US_ASCII: Encoding
490
+
491
+ Encoding::UTF8_DOCOMO: Encoding
492
+
493
+ Encoding::UTF8_DoCoMo: Encoding
494
+
495
+ Encoding::UTF8_KDDI: Encoding
496
+
497
+ Encoding::UTF8_MAC: Encoding
498
+
499
+ Encoding::UTF8_SOFTBANK: Encoding
500
+
501
+ Encoding::UTF8_SoftBank: Encoding
502
+
503
+ Encoding::UTF_16: Encoding
504
+
505
+ Encoding::UTF_16BE: Encoding
506
+
507
+ Encoding::UTF_16LE: Encoding
508
+
509
+ Encoding::UTF_32: Encoding
510
+
511
+ Encoding::UTF_32BE: Encoding
512
+
513
+ Encoding::UTF_32LE: Encoding
514
+
515
+ Encoding::UTF_7: Encoding
516
+
517
+ Encoding::UTF_8: Encoding
518
+
519
+ Encoding::UTF_8_HFS: Encoding
520
+
521
+ Encoding::UTF_8_MAC: Encoding
522
+
523
+ Encoding::WINDOWS_1250: Encoding
524
+
525
+ Encoding::WINDOWS_1251: Encoding
526
+
527
+ Encoding::WINDOWS_1252: Encoding
528
+
529
+ Encoding::WINDOWS_1253: Encoding
530
+
531
+ Encoding::WINDOWS_1254: Encoding
532
+
533
+ Encoding::WINDOWS_1255: Encoding
534
+
535
+ Encoding::WINDOWS_1256: Encoding
536
+
537
+ Encoding::WINDOWS_1257: Encoding
538
+
539
+ Encoding::WINDOWS_1258: Encoding
540
+
541
+ Encoding::WINDOWS_31J: Encoding
542
+
543
+ Encoding::WINDOWS_874: Encoding
544
+
545
+ Encoding::Windows_1250: Encoding
546
+
547
+ Encoding::Windows_1251: Encoding
548
+
549
+ Encoding::Windows_1252: Encoding
550
+
551
+ Encoding::Windows_1253: Encoding
552
+
553
+ Encoding::Windows_1254: Encoding
554
+
555
+ Encoding::Windows_1255: Encoding
556
+
557
+ Encoding::Windows_1256: Encoding
558
+
559
+ Encoding::Windows_1257: Encoding
560
+
561
+ Encoding::Windows_1258: Encoding
562
+
563
+ Encoding::Windows_31J: Encoding
564
+
565
+ Encoding::Windows_874: Encoding
566
+
567
+ class Encoding::Converter < Data
568
+ end
569
+
570
+ Encoding::Converter::AFTER_OUTPUT: Integer
571
+
572
+ Encoding::Converter::CRLF_NEWLINE_DECORATOR: Integer
573
+
574
+ Encoding::Converter::CR_NEWLINE_DECORATOR: Integer
575
+
576
+ Encoding::Converter::INVALID_MASK: Integer
577
+
578
+ Encoding::Converter::INVALID_REPLACE: Integer
579
+
580
+ Encoding::Converter::PARTIAL_INPUT: Integer
581
+
582
+ Encoding::Converter::UNDEF_HEX_CHARREF: Integer
583
+
584
+ Encoding::Converter::UNDEF_MASK: Integer
585
+
586
+ Encoding::Converter::UNDEF_REPLACE: Integer
587
+
588
+ Encoding::Converter::UNIVERSAL_NEWLINE_DECORATOR: Integer
589
+
590
+ Encoding::Converter::XML_ATTR_CONTENT_DECORATOR: Integer
591
+
592
+ Encoding::Converter::XML_ATTR_QUOTE_DECORATOR: Integer
593
+
594
+ Encoding::Converter::XML_TEXT_DECORATOR: Integer
595
+
596
+ class Encoding::CompatibilityError < EncodingError
597
+ end
598
+
599
+ class Encoding::ConverterNotFoundError < EncodingError
600
+ end
601
+
602
+ class Encoding::InvalidByteSequenceError < EncodingError
603
+ end
604
+
605
+ class Encoding::UndefinedConversionError < EncodingError
606
+ end