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,426 @@
1
+ # A `Proc` object is an encapsulation of a block of code, which can be
2
+ # stored in a local variable, passed to a method or another
3
+ # [Proc](Proc), and can be called.
4
+ # [Proc](Proc) is an essential concept in Ruby and a
5
+ # core of its functional programming features.
6
+ #
7
+ # ```ruby
8
+ # square = Proc.new {|x| x**2 }
9
+ #
10
+ # square.call(3) #=> 9
11
+ # # shorthands:
12
+ # square.(3) #=> 9
13
+ # square[3] #=> 9
14
+ # ```
15
+ #
16
+ # [Proc](Proc) objects are *closures* , meaning they
17
+ # remember and can use the entire context in which they were created.
18
+ #
19
+ # ```ruby
20
+ # def gen_times(factor)
21
+ # Proc.new {|n| n*factor } # remembers the value of factor at the moment of creation
22
+ # end
23
+ #
24
+ # times3 = gen_times(3)
25
+ # times5 = gen_times(5)
26
+ #
27
+ # times3.call(12) #=> 36
28
+ # times5.call(5) #=> 25
29
+ # times3.call(times5.call(4)) #=> 60
30
+ # ```
31
+ #
32
+ #
33
+ # There are several methods to create a [Proc](Proc)
34
+ #
35
+ # - Use the [Proc](Proc) class constructor:
36
+ #
37
+ # ```ruby
38
+ # proc1 = Proc.new {|x| x**2 }
39
+ # ```
40
+ #
41
+ # - Use the
42
+ # [Kernel\#proc](https://ruby-doc.org/core-2.6.3/Kernel.html#method-i-proc)
43
+ # method as a shorthand of
44
+ # [::new](Proc#method-c-new):
45
+ #
46
+ # ```ruby
47
+ # proc2 = proc {|x| x**2 }
48
+ # ```
49
+ #
50
+ # - Receiving a block of code into proc argument (note the `&` ):
51
+ #
52
+ # ```ruby
53
+ # def make_proc(&block)
54
+ # block
55
+ # end
56
+ #
57
+ # proc3 = make_proc {|x| x**2 }
58
+ # ```
59
+ #
60
+ # - Construct a proc with lambda semantics using the
61
+ # [Kernel\#lambda](https://ruby-doc.org/core-2.6.3/Kernel.html#method-i-lambda)
62
+ # method (see below for explanations about lambdas):
63
+ #
64
+ # ```ruby
65
+ # lambda1 = lambda {|x| x**2 }
66
+ # ```
67
+ #
68
+ # - Use the Lambda literal syntax (also constructs a proc with lambda
69
+ # semantics):
70
+ #
71
+ # ```ruby
72
+ # lambda2 = ->(x) { x**2 }
73
+ # ```
74
+ #
75
+ #
76
+ # Procs are coming in two flavors: lambda and non-lambda (regular procs).
77
+ # Differences are:
78
+ #
79
+ # - In lambdas, `return` means exit from this lambda;
80
+ #
81
+ # - In regular procs, `return` means exit from embracing method (and
82
+ # will throw `LocalJumpError` if invoked outside the method);
83
+ #
84
+ # - In lambdas, arguments are treated in the same way as in methods:
85
+ # strict, with `ArgumentError` for mismatching argument number, and no
86
+ # additional argument processing;
87
+ #
88
+ # - Regular procs accept arguments more generously: missing arguments
89
+ # are filled with `nil`, single
90
+ # [Array](https://ruby-doc.org/core-2.6.3/Array.html) arguments are
91
+ # deconstructed if the proc has multiple arguments, and there is no
92
+ # error raised on extra arguments.
93
+ #
94
+ # Examples:
95
+ #
96
+ # ```ruby
97
+ # p = proc {|x, y| "x=#{x}, y=#{y}" }
98
+ # p.call(1, 2) #=> "x=1, y=2"
99
+ # p.call([1, 2]) #=> "x=1, y=2", array deconstructed
100
+ # p.call(1, 2, 8) #=> "x=1, y=2", extra argument discarded
101
+ # p.call(1) #=> "x=1, y=", nil substituted instead of error
102
+ #
103
+ # l = lambda {|x, y| "x=#{x}, y=#{y}" }
104
+ # l.call(1, 2) #=> "x=1, y=2"
105
+ # l.call([1, 2]) # ArgumentError: wrong number of arguments (given 1, expected 2)
106
+ # l.call(1, 2, 8) # ArgumentError: wrong number of arguments (given 3, expected 2)
107
+ # l.call(1) # ArgumentError: wrong number of arguments (given 1, expected 2)
108
+ #
109
+ # def test_return
110
+ # -> { return 3 }.call # just returns from lambda into method body
111
+ # proc { return 4 }.call # returns from method
112
+ # return 5
113
+ # end
114
+ #
115
+ # test_return # => 4, return from proc
116
+ # ```
117
+ #
118
+ # Lambdas are useful as self-sufficient functions, in particular useful as
119
+ # arguments to higher-order functions, behaving exactly like Ruby methods.
120
+ #
121
+ # Procs are useful for implementing iterators:
122
+ #
123
+ # ```ruby
124
+ # def test
125
+ # [[1, 2], [3, 4], [5, 6]].map {|a, b| return a if a + b > 10 }
126
+ # # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
127
+ # end
128
+ # ```
129
+ #
130
+ # Inside `map`, the block of code is treated as a regular (non-lambda)
131
+ # proc, which means that the internal arrays will be deconstructed to
132
+ # pairs of arguments, and `return` will exit from the method `test` . That
133
+ # would not be possible with a stricter lambda.
134
+ #
135
+ # You can tell a lambda from a regular proc by using the
136
+ # [lambda?](Proc#method-i-lambda-3F) instance method.
137
+ #
138
+ # Lambda semantics is typically preserved during the proc lifetime,
139
+ # including `&` -deconstruction to a block of code:
140
+ #
141
+ # ```ruby
142
+ # p = proc {|x, y| x }
143
+ # l = lambda {|x, y| x }
144
+ # [[1, 2], [3, 4]].map(&p) #=> [1, 2]
145
+ # [[1, 2], [3, 4]].map(&l) # ArgumentError: wrong number of arguments (given 1, expected 2)
146
+ # ```
147
+ #
148
+ # The only exception is dynamic method definition: even if defined by
149
+ # passing a non-lambda proc, methods still have normal semantics of
150
+ # argument checking.
151
+ #
152
+ # ```ruby
153
+ # class C
154
+ # define_method(:e, &proc {})
155
+ # end
156
+ # C.new.e(1,2) #=> ArgumentError
157
+ # C.new.method(:e).to_proc.lambda? #=> true
158
+ # ```
159
+ #
160
+ # This exception ensures that methods never have unusual argument passing
161
+ # conventions, and makes it easy to have wrappers defining methods that
162
+ # behave as usual.
163
+ #
164
+ # ```ruby
165
+ # class C
166
+ # def self.def2(name, &body)
167
+ # define_method(name, &body)
168
+ # end
169
+ #
170
+ # def2(:f) {}
171
+ # end
172
+ # C.new.f(1,2) #=> ArgumentError
173
+ # ```
174
+ #
175
+ # The wrapper *def2* receives `body` as a non-lambda proc, yet defines a
176
+ # method which has normal semantics.
177
+ #
178
+ #
179
+ # Any object that implements the `to_proc` method can be converted into a
180
+ # proc by the `&` operator, and therefore con be consumed by iterators.
181
+ #
182
+ # ```ruby
183
+ # class Greater
184
+ # def initialize(greating)
185
+ # @greating = greating
186
+ # end
187
+ #
188
+ # def to_proc
189
+ # proc {|name| "#{@greating}, #{name}!" }
190
+ # end
191
+ # end
192
+ #
193
+ # hi = Greater.new("Hi")
194
+ # hey = Greater.new("Hey")
195
+ # ["Bob", "Jane"].map(&hi) #=> ["Hi, Bob!", "Hi, Jane!"]
196
+ # ["Bob", "Jane"].map(&hey) #=> ["Hey, Bob!", "Hey, Jane!"]
197
+ # ```
198
+ #
199
+ # Of the Ruby core classes, this method is implemented by
200
+ # [Symbol](https://ruby-doc.org/core-2.6.3/Symbol.html),
201
+ # [Method](https://ruby-doc.org/core-2.6.3/Method.html), and
202
+ # [Hash](https://ruby-doc.org/core-2.6.3/Hash.html).
203
+ #
204
+ # :to_s.to_proc.call(1) #=> "1"
205
+ # [1, 2].map(&:to_s) #=> ["1", "2"]
206
+ #
207
+ # method(:puts).to_proc.call(1) # prints 1
208
+ # [1, 2].each(&method(:puts)) # prints 1, 2
209
+ #
210
+ # {test: 1}.to_proc.call(:test) #=> 1
211
+ # %i[test many keys].map(&{test: 1}) #=> [1, nil, nil]
212
+ class Proc < Object
213
+ # Returns the number of mandatory arguments. If the block is declared to
214
+ # take no arguments, returns 0. If the block is known to take exactly n
215
+ # arguments, returns n. If the block has optional arguments, returns -n-1,
216
+ # where n is the number of mandatory arguments, with the exception for
217
+ # blocks that are not lambdas and have only a finite number of optional
218
+ # arguments; in this latter case, returns n. Keyword arguments will be
219
+ # considered as a single additional argument, that argument being
220
+ # mandatory if any keyword argument is mandatory. A `proc` with no
221
+ # argument declarations is the same as a block declaring `||` as its
222
+ # arguments.
223
+ #
224
+ # proc {}.arity #=> 0
225
+ # proc { || }.arity #=> 0
226
+ # proc { |a| }.arity #=> 1
227
+ # proc { |a, b| }.arity #=> 2
228
+ # proc { |a, b, c| }.arity #=> 3
229
+ # proc { |*a| }.arity #=> -1
230
+ # proc { |a, *b| }.arity #=> -2
231
+ # proc { |a, *b, c| }.arity #=> -3
232
+ # proc { |x:, y:, z:0| }.arity #=> 1
233
+ # proc { |*a, x:, y:0| }.arity #=> -2
234
+ #
235
+ # proc { |a=0| }.arity #=> 0
236
+ # lambda { |a=0| }.arity #=> -1
237
+ # proc { |a=0, b| }.arity #=> 1
238
+ # lambda { |a=0, b| }.arity #=> -2
239
+ # proc { |a=0, b=0| }.arity #=> 0
240
+ # lambda { |a=0, b=0| }.arity #=> -1
241
+ # proc { |a, b=0| }.arity #=> 1
242
+ # lambda { |a, b=0| }.arity #=> -2
243
+ # proc { |(a, b), c=0| }.arity #=> 1
244
+ # lambda { |(a, b), c=0| }.arity #=> -2
245
+ # proc { |a, x:0, y:0| }.arity #=> 1
246
+ # lambda { |a, x:0, y:0| }.arity #=> -2
247
+ def arity: () -> Integer
248
+
249
+ # Returns the binding associated with *prc* .
250
+ #
251
+ # ```ruby
252
+ # def fred(param)
253
+ # proc {}
254
+ # end
255
+ #
256
+ # b = fred(99)
257
+ # eval("param", b.binding) #=> 99
258
+ # ```
259
+ def binding: () -> Binding
260
+
261
+ def call: (*untyped arg0) -> untyped
262
+
263
+ def []: (*untyped arg0) -> untyped
264
+
265
+ def curry: (?Integer arity) -> Proc
266
+
267
+ # Returns a hash value corresponding to proc body.
268
+ #
269
+ # See also Object\#hash.
270
+ def hash: () -> Integer
271
+
272
+ # Returns `true` for a [Proc](Proc.downloaded.ruby_doc) object for which
273
+ # argument handling is rigid. Such procs are typically generated by
274
+ # `lambda` .
275
+ #
276
+ # A [Proc](Proc.downloaded.ruby_doc) object generated by `proc` ignores
277
+ # extra arguments.
278
+ #
279
+ # ```ruby
280
+ # proc {|a,b| [a,b] }.call(1,2,3) #=> [1,2]
281
+ # ```
282
+ #
283
+ # It provides `nil` for missing arguments.
284
+ #
285
+ # ```ruby
286
+ # proc {|a,b| [a,b] }.call(1) #=> [1,nil]
287
+ # ```
288
+ #
289
+ # It expands a single array argument.
290
+ #
291
+ # ```ruby
292
+ # proc {|a,b| [a,b] }.call([1,2]) #=> [1,2]
293
+ # ```
294
+ #
295
+ # A [Proc](Proc.downloaded.ruby_doc) object generated by `lambda` doesn’t
296
+ # have such tricks.
297
+ #
298
+ # ```ruby
299
+ # lambda {|a,b| [a,b] }.call(1,2,3) #=> ArgumentError
300
+ # lambda {|a,b| [a,b] }.call(1) #=> ArgumentError
301
+ # lambda {|a,b| [a,b] }.call([1,2]) #=> ArgumentError
302
+ # ```
303
+ #
304
+ # [\#lambda?](Proc.downloaded.ruby_doc#method-i-lambda-3F) is a predicate
305
+ # for the tricks. It returns `true` if no tricks apply.
306
+ #
307
+ # ```ruby
308
+ # lambda {}.lambda? #=> true
309
+ # proc {}.lambda? #=> false
310
+ # ```
311
+ #
312
+ # [::new](Proc.downloaded.ruby_doc#method-c-new) is the same as `proc` .
313
+ #
314
+ # ```ruby
315
+ # Proc.new {}.lambda? #=> false
316
+ # ```
317
+ #
318
+ # `lambda`, `proc` and [::new](Proc.downloaded.ruby_doc#method-c-new)
319
+ # preserve the tricks of a [Proc](Proc.downloaded.ruby_doc) object given
320
+ # by `&` argument.
321
+ #
322
+ # ```ruby
323
+ # lambda(&lambda {}).lambda? #=> true
324
+ # proc(&lambda {}).lambda? #=> true
325
+ # Proc.new(&lambda {}).lambda? #=> true
326
+ #
327
+ # lambda(&proc {}).lambda? #=> false
328
+ # proc(&proc {}).lambda? #=> false
329
+ # Proc.new(&proc {}).lambda? #=> false
330
+ # ```
331
+ #
332
+ # A [Proc](Proc.downloaded.ruby_doc) object generated by `&` argument has
333
+ # the tricks
334
+ #
335
+ # ```ruby
336
+ # def n(&b) b.lambda? end
337
+ # n {} #=> false
338
+ # ```
339
+ #
340
+ # The `&` argument preserves the tricks if a
341
+ # [Proc](Proc.downloaded.ruby_doc) object is given by `&` argument.
342
+ #
343
+ # ```ruby
344
+ # n(&lambda {}) #=> true
345
+ # n(&proc {}) #=> false
346
+ # n(&Proc.new {}) #=> false
347
+ # ```
348
+ #
349
+ # A [Proc](Proc.downloaded.ruby_doc) object converted from a method has no
350
+ # tricks.
351
+ #
352
+ # ```ruby
353
+ # def m() end
354
+ # method(:m).to_proc.lambda? #=> true
355
+ #
356
+ # n(&method(:m)) #=> true
357
+ # n(&method(:m).to_proc) #=> true
358
+ # ```
359
+ #
360
+ # `define_method` is treated the same as method definition. The defined
361
+ # method has no tricks.
362
+ #
363
+ # ```ruby
364
+ # class C
365
+ # define_method(:d) {}
366
+ # end
367
+ # C.new.d(1,2) #=> ArgumentError
368
+ # C.new.method(:d).to_proc.lambda? #=> true
369
+ # ```
370
+ #
371
+ # `define_method` always defines a method without the tricks, even if a
372
+ # non-lambda [Proc](Proc.downloaded.ruby_doc) object is given. This is the
373
+ # only exception for which the tricks are not preserved.
374
+ #
375
+ # ```ruby
376
+ # class C
377
+ # define_method(:e, &proc {})
378
+ # end
379
+ # C.new.e(1,2) #=> ArgumentError
380
+ # C.new.method(:e).to_proc.lambda? #=> true
381
+ # ```
382
+ #
383
+ # This exception ensures that methods never have tricks and makes it easy
384
+ # to have wrappers to define methods that behave as usual.
385
+ #
386
+ # ```ruby
387
+ # class C
388
+ # def self.def2(name, &body)
389
+ # define_method(name, &body)
390
+ # end
391
+ #
392
+ # def2(:f) {}
393
+ # end
394
+ # C.new.f(1,2) #=> ArgumentError
395
+ # ```
396
+ #
397
+ # The wrapper *def2* defines a method which has no tricks.
398
+ def lambda?: () -> bool
399
+
400
+ # Returns the parameter information of this proc.
401
+ #
402
+ # ```ruby
403
+ # prc = lambda{|x, y=42, *other|}
404
+ # prc.parameters #=> [[:req, :x], [:opt, :y], [:rest, :other]]
405
+ # ```
406
+ def parameters: () -> ::Array[[ Symbol, Symbol ]]
407
+
408
+ # Returns the Ruby source filename and line number containing this proc or
409
+ # `nil` if this proc was not defined in Ruby (i.e. native).
410
+ def source_location: () -> [ String, Integer ]
411
+
412
+ # Part of the protocol for converting objects to `Proc` objects. Instances
413
+ # of class `Proc` simply return themselves.
414
+ def to_proc: () -> self
415
+
416
+ # Returns the unique identifier for this proc, along with an indication of
417
+ # where the proc was defined.
418
+ #
419
+ #
420
+ #
421
+ # Also aliased as: [inspect](Proc.downloaded.ruby_doc#method-i-inspect)
422
+ def to_s: () -> String
423
+
424
+ # Alias for: [to\_s](Proc.downloaded.ruby_doc#method-i-to_s)
425
+ def inspect: () -> String
426
+ end
@@ -0,0 +1,354 @@
1
+ # [Module](https://ruby-doc.org/core-2.6.3/Module.html) to handle
2
+ # processes.
3
+ module Process
4
+ # Returns the name of the script being executed. The value is not affected
5
+ # by assigning a new value to $0.
6
+ #
7
+ # This method first appeared in Ruby 2.1 to serve as a global variable
8
+ # free means to get the script name.
9
+ def self.argv0: () -> String
10
+
11
+ def self.clock_getres: (Symbol | Integer clock_id, ?Symbol unit) -> (Float | Integer)
12
+
13
+ def self.clock_gettime: (Symbol | Integer clock_id, ?Symbol unit) -> (Float | Integer)
14
+
15
+ def self.daemon: (?untyped nochdir, ?untyped noclose) -> Integer
16
+
17
+ def self.detach: (Integer pid) -> Thread
18
+
19
+ # Returns the effective group ID for this process. Not available on all
20
+ # platforms.
21
+ #
22
+ # ```ruby
23
+ # Process.egid #=> 500
24
+ # ```
25
+ def self.egid: () -> Integer
26
+
27
+ def self.egid=: (Integer arg0) -> Integer
28
+
29
+ # Returns the effective user ID for this process.
30
+ #
31
+ # ```ruby
32
+ # Process.euid #=> 501
33
+ # ```
34
+ def self.euid: () -> Integer
35
+
36
+ def self.euid=: (Integer arg0) -> Integer
37
+
38
+ def self.getpgid: (Integer pid) -> Integer
39
+
40
+ # Returns the process group ID for this process. Not available on all
41
+ # platforms.
42
+ #
43
+ # ```ruby
44
+ # Process.getpgid(0) #=> 25527
45
+ # Process.getpgrp #=> 25527
46
+ # ```
47
+ def self.getpgrp: () -> Integer
48
+
49
+ def self.getpriority: (Integer kind, Integer arg0) -> Integer
50
+
51
+ def self.getrlimit: (Symbol | String | Integer resource) -> [ Integer, Integer ]
52
+
53
+ def self.getsid: (?Integer pid) -> Integer
54
+
55
+ # Returns the (real) group ID for this process.
56
+ #
57
+ # ```ruby
58
+ # Process.gid #=> 500
59
+ # ```
60
+ def self.gid: () -> Integer
61
+
62
+ def self.gid=: (Integer arg0) -> Integer
63
+
64
+ # Get an `Array` of the group IDs in the supplemental group access list
65
+ # for this process.
66
+ #
67
+ # ```ruby
68
+ # Process.groups #=> [27, 6, 10, 11]
69
+ # ```
70
+ #
71
+ # Note that this method is just a wrapper of getgroups(2). This means that
72
+ # the following characteristics of the result completely depend on your
73
+ # system:
74
+ #
75
+ # - the result is sorted
76
+ #
77
+ # - the result includes effective GIDs
78
+ #
79
+ # - the result does not include duplicated GIDs
80
+ #
81
+ # You can make sure to get a sorted unique
82
+ # [GID](https://ruby-doc.org/core-2.6.3/Process/GID.html) list of the
83
+ # current process by this expression:
84
+ #
85
+ # ```ruby
86
+ # Process.groups.uniq.sort
87
+ # ```
88
+ def self.groups: () -> ::Array[Integer]
89
+
90
+ def self.groups=: (::Array[Integer] arg0) -> ::Array[Integer]
91
+
92
+ def self.initgroups: (String username, Integer gid) -> ::Array[Integer]
93
+
94
+ def self.kill: (Integer | Symbol | String signal, *Integer pids) -> Integer
95
+
96
+ # Returns the maximum number of gids allowed in the supplemental group
97
+ # access list.
98
+ #
99
+ # ```ruby
100
+ # Process.maxgroups #=> 32
101
+ # ```
102
+ def self.maxgroups: () -> Integer
103
+
104
+ def self.maxgroups=: (Integer arg0) -> Integer
105
+
106
+ # Returns the process id of this process. Not available on all platforms.
107
+ #
108
+ # ```ruby
109
+ # Process.pid #=> 27415
110
+ # ```
111
+ def self.pid: () -> Integer
112
+
113
+ # Returns the process id of the parent of this process. Returns
114
+ # untrustworthy value on Win32/64. Not available on all platforms.
115
+ #
116
+ # ```ruby
117
+ # puts "I am #{Process.pid}"
118
+ # Process.fork { puts "Dad is #{Process.ppid}" }
119
+ # ```
120
+ #
121
+ # *produces:*
122
+ #
123
+ # ```ruby
124
+ # I am 27417
125
+ # Dad is 27417
126
+ # ```
127
+ def self.ppid: () -> Integer
128
+
129
+ def self.setpgid: (Integer pid, Integer arg0) -> Integer
130
+
131
+ def self.setpriority: (Integer kind, Integer arg0, Integer priority) -> Integer
132
+
133
+ def self.setproctitle: (String arg0) -> String
134
+
135
+ def self.setrlimit: (Symbol | String | Integer resource, Integer cur_limit, ?Integer max_limit) -> NilClass
136
+
137
+ # Establishes this process as a new session and process group leader, with
138
+ # no controlling tty. Returns the session id. Not available on all
139
+ # platforms.
140
+ #
141
+ # ```ruby
142
+ # Process.setsid #=> 27422
143
+ # ```
144
+ def self.setsid: () -> Integer
145
+
146
+ # Returns a `Tms` structure (see `Process::Tms` ) that contains user and
147
+ # system CPU times for this process, and also for children processes.
148
+ #
149
+ # ```ruby
150
+ # t = Process.times
151
+ # [ t.utime, t.stime, t.cutime, t.cstime ] #=> [0.0, 0.02, 0.00, 0.00]
152
+ # ```
153
+ def self.times: () -> Process::Tms
154
+
155
+ # Returns the (real) user ID of this process.
156
+ #
157
+ # ```ruby
158
+ # Process.uid #=> 501
159
+ # ```
160
+ def self.uid: () -> Integer
161
+
162
+ def self.uid=: (Integer user) -> Integer
163
+
164
+ def self.wait: (?Integer pid, ?Integer flags) -> Integer
165
+
166
+ def self.wait2: (?Integer pid, ?Integer flags) -> [ Integer, Process::Status ]
167
+
168
+ def self.waitall: () -> ::Array[[ Integer, Process::Status ]]
169
+
170
+ def self.waitpid: (?Integer pid, ?Integer flags) -> Integer
171
+
172
+ def self.waitpid2: (?Integer pid, ?Integer flags) -> [ Integer, Process::Status ]
173
+ end
174
+
175
+ Process::CLOCK_BOOTTIME: Integer
176
+
177
+ Process::CLOCK_BOOTTIME_ALARM: Integer
178
+
179
+ Process::CLOCK_MONOTONIC: Integer
180
+
181
+ Process::CLOCK_MONOTONIC_COARSE: Integer
182
+
183
+ Process::CLOCK_MONOTONIC_RAW: Integer
184
+
185
+ Process::CLOCK_PROCESS_CPUTIME_ID: Integer
186
+
187
+ Process::CLOCK_REALTIME: Integer
188
+
189
+ Process::CLOCK_REALTIME_ALARM: Integer
190
+
191
+ Process::CLOCK_REALTIME_COARSE: Integer
192
+
193
+ Process::CLOCK_THREAD_CPUTIME_ID: Integer
194
+
195
+ Process::PRIO_PGRP: Integer
196
+
197
+ Process::PRIO_PROCESS: Integer
198
+
199
+ Process::PRIO_USER: Integer
200
+
201
+ Process::RLIMIT_AS: Integer
202
+
203
+ Process::RLIMIT_CORE: Integer
204
+
205
+ Process::RLIMIT_CPU: Integer
206
+
207
+ Process::RLIMIT_DATA: Integer
208
+
209
+ Process::RLIMIT_FSIZE: Integer
210
+
211
+ Process::RLIMIT_MEMLOCK: Integer
212
+
213
+ Process::RLIMIT_MSGQUEUE: Integer
214
+
215
+ Process::RLIMIT_NICE: Integer
216
+
217
+ Process::RLIMIT_NOFILE: Integer
218
+
219
+ Process::RLIMIT_NPROC: Integer
220
+
221
+ Process::RLIMIT_RSS: Integer
222
+
223
+ Process::RLIMIT_RTPRIO: Integer
224
+
225
+ Process::RLIMIT_RTTIME: Integer
226
+
227
+ Process::RLIMIT_SIGPENDING: Integer
228
+
229
+ Process::RLIMIT_STACK: Integer
230
+
231
+ Process::RLIM_INFINITY: Integer
232
+
233
+ Process::RLIM_SAVED_CUR: Integer
234
+
235
+ Process::RLIM_SAVED_MAX: Integer
236
+
237
+ Process::WNOHANG: Integer
238
+
239
+ Process::WUNTRACED: Integer
240
+
241
+ module Process::GID
242
+ def self.change_privilege: (Integer group) -> Integer
243
+
244
+ def self.eid: () -> Integer
245
+
246
+ def self.from_name: (String name) -> Integer
247
+
248
+ def self.grant_privilege: (Integer group) -> Integer
249
+
250
+ def self.re_exchange: () -> Integer
251
+
252
+ def self.re_exchangeable?: () -> bool
253
+
254
+ def self.rid: () -> Integer
255
+
256
+ def self.sid_available?: () -> bool
257
+
258
+ def self.switch: () -> Integer
259
+ | [T] () { () -> T } -> T
260
+
261
+ def self.eid=: (Integer group) -> Integer
262
+ end
263
+
264
+ class Process::Status < Object
265
+ def &: (Integer num) -> Integer
266
+
267
+ def ==: (untyped other) -> bool
268
+
269
+ def >>: (Integer num) -> Integer
270
+
271
+ def coredump?: () -> bool
272
+
273
+ def exited?: () -> bool
274
+
275
+ def exitstatus: () -> Integer?
276
+
277
+ def inspect: () -> String
278
+
279
+ def pid: () -> Integer
280
+
281
+ def signaled?: () -> bool
282
+
283
+ def stopped?: () -> bool
284
+
285
+ def stopsig: () -> Integer?
286
+
287
+ def success?: () -> bool
288
+
289
+ def termsig: () -> Integer?
290
+
291
+ def to_i: () -> Integer
292
+
293
+ def to_s: () -> String
294
+ end
295
+
296
+ module Process::Sys
297
+ def self.geteuid: () -> Integer
298
+
299
+ def self.getgid: () -> Integer
300
+
301
+ def self.getuid: () -> Integer
302
+
303
+ def self.issetugid: () -> bool
304
+
305
+ def self.setegid: (Integer group) -> NilClass
306
+
307
+ def self.seteuid: (Integer user) -> NilClass
308
+
309
+ def self.setgid: (Integer group) -> NilClass
310
+
311
+ def self.setregid: (Integer rid, Integer eid) -> NilClass
312
+
313
+ def self.setresgid: (Integer rid, Integer eid, Integer sid) -> NilClass
314
+
315
+ def self.setresuid: (Integer rid, Integer eid, Integer sid) -> NilClass
316
+
317
+ def self.setreuid: (Integer rid, Integer eid) -> NilClass
318
+
319
+ def self.setrgid: (Integer group) -> NilClass
320
+
321
+ def self.setruid: (Integer user) -> NilClass
322
+
323
+ def self.setuid: (Integer user) -> NilClass
324
+ end
325
+
326
+ module Process::UID
327
+ def self.change_privilege: (Integer user) -> Integer
328
+
329
+ def self.eid: () -> Integer
330
+
331
+ def self.from_name: (String name) -> Integer
332
+
333
+ def self.grant_privilege: (Integer user) -> Integer
334
+
335
+ def self.re_exchange: () -> Integer
336
+
337
+ def self.re_exchangeable?: () -> bool
338
+
339
+ def self.rid: () -> Integer
340
+
341
+ def self.sid_available?: () -> bool
342
+
343
+ def self.switch: () -> Integer
344
+ | [T] () { () -> T } -> T
345
+
346
+ def self.eid=: (Integer user) -> Integer
347
+ end
348
+
349
+ class Process::Tms < Struct[Float]
350
+ end
351
+
352
+ class Process::Waiter < Thread
353
+ def pid: () -> Integer
354
+ end