rbs 2.0.0 → 2.1.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.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +5 -0
- data/CHANGELOG.md +23 -0
- data/README.md +6 -1
- data/core/array.rbs +2866 -1086
- data/core/basic_object.rbs +150 -30
- data/core/binding.rbs +33 -0
- data/core/builtin.rbs +4 -4
- data/core/class.rbs +43 -5
- data/core/comparable.rbs +57 -0
- data/core/complex.rbs +170 -4
- data/core/constants.rbs +51 -0
- data/core/deprecated.rbs +7 -0
- data/core/dir.rbs +305 -20
- data/core/encoding.rbs +472 -77
- data/core/enumerable.rbs +2173 -234
- data/core/enumerator.rbs +448 -182
- data/core/env.rbs +448 -1
- data/core/errno.rbs +1 -10
- data/core/errors.rbs +152 -2
- data/core/exception.rbs +201 -127
- data/core/false_class.rbs +27 -0
- data/core/fiber.rbs +118 -37
- data/core/fiber_error.rbs +8 -9
- data/core/file.rbs +1059 -139
- data/core/file_test.rbs +287 -32
- data/core/float.rbs +776 -300
- data/core/gc.rbs +185 -34
- data/core/global_variables.rbs +5 -1
- data/core/hash.rbs +1582 -649
- data/core/integer.rbs +974 -204
- data/core/io/buffer.rbs +710 -0
- data/core/io/wait.rbs +29 -8
- data/core/io.rbs +2438 -417
- data/core/kernel.rbs +2315 -316
- data/core/marshal.rbs +37 -2
- data/core/match_data.rbs +123 -6
- data/core/math.rbs +126 -6
- data/core/method.rbs +226 -102
- data/core/module.rbs +421 -45
- data/core/nil_class.rbs +64 -0
- data/core/numeric.rbs +620 -142
- data/core/object.rbs +453 -81
- data/core/object_space.rbs +92 -2
- data/core/proc.rbs +482 -285
- data/core/process.rbs +443 -34
- data/core/ractor.rbs +232 -9
- data/core/random.rbs +151 -52
- data/core/range.rbs +885 -160
- data/core/rational.rbs +122 -6
- data/core/rb_config.rbs +14 -4
- data/core/refinement.rbs +44 -0
- data/core/regexp.rbs +156 -14
- data/core/ruby_vm.rbs +42 -3
- data/core/signal.rbs +78 -39
- data/core/string.rbs +2123 -567
- data/core/string_io.rbs +204 -0
- data/core/struct.rbs +283 -28
- data/core/symbol.rbs +304 -30
- data/core/thread.rbs +1288 -688
- data/core/thread_group.rbs +66 -10
- data/core/time.rbs +643 -217
- data/core/trace_point.rbs +100 -12
- data/core/true_class.rbs +24 -0
- data/core/unbound_method.rbs +73 -7
- data/core/warning.rbs +37 -12
- data/docs/CONTRIBUTING.md +40 -34
- data/docs/stdlib.md +3 -102
- data/lib/rbs/annotate/annotations.rb +197 -0
- data/lib/rbs/annotate/formatter.rb +80 -0
- data/lib/rbs/annotate/rdoc_annotator.rb +398 -0
- data/lib/rbs/annotate/rdoc_source.rb +120 -0
- data/lib/rbs/annotate.rb +6 -0
- data/lib/rbs/cli.rb +45 -1
- data/lib/rbs/definition_builder.rb +5 -1
- data/lib/rbs/location_aux.rb +12 -0
- data/lib/rbs/prototype/rb.rb +12 -0
- data/lib/rbs/version.rb +1 -1
- data/sig/annotate/annotations.rbs +102 -0
- data/sig/annotate/formatter.rbs +24 -0
- data/sig/annotate/rdoc_annotater.rbs +82 -0
- data/sig/annotate/rdoc_source.rbs +30 -0
- data/sig/cli.rbs +2 -0
- data/sig/collection/{collections.rbs → sources.rbs} +0 -0
- data/sig/location.rbs +6 -0
- data/sig/method_types.rbs +5 -1
- data/sig/polyfill.rbs +78 -0
- data/stdlib/abbrev/0/abbrev.rbs +6 -0
- data/stdlib/abbrev/0/array.rbs +26 -0
- data/stdlib/base64/0/base64.rbs +31 -0
- data/stdlib/benchmark/0/benchmark.rbs +74 -3
- data/stdlib/bigdecimal/0/big_decimal.rbs +614 -165
- data/stdlib/bigdecimal-math/0/big_math.rbs +41 -64
- data/stdlib/cgi/0/core.rbs +59 -0
- data/stdlib/coverage/0/coverage.rbs +164 -2
- data/stdlib/csv/0/csv.rbs +2862 -398
- data/stdlib/date/0/date.rbs +483 -25
- data/stdlib/date/0/date_time.rbs +187 -12
- data/stdlib/dbm/0/dbm.rbs +152 -17
- data/stdlib/digest/0/digest.rbs +146 -0
- data/stdlib/erb/0/erb.rbs +65 -245
- data/stdlib/fiber/0/fiber.rbs +73 -91
- data/stdlib/fileutils/0/fileutils.rbs +301 -1
- data/stdlib/find/0/find.rbs +9 -0
- data/stdlib/forwardable/0/forwardable.rbs +65 -1
- data/stdlib/io-console/0/io-console.rbs +227 -15
- data/stdlib/ipaddr/0/ipaddr.rbs +161 -0
- data/stdlib/json/0/json.rbs +1146 -144
- data/stdlib/logger/0/formatter.rbs +24 -0
- data/stdlib/logger/0/log_device.rbs +64 -0
- data/stdlib/logger/0/logger.rbs +165 -13
- data/stdlib/logger/0/period.rbs +10 -0
- data/stdlib/logger/0/severity.rbs +26 -0
- data/stdlib/monitor/0/monitor.rbs +163 -0
- data/stdlib/mutex_m/0/mutex_m.rbs +35 -6
- data/stdlib/net-http/0/net-http.rbs +1492 -683
- data/stdlib/nkf/0/nkf.rbs +372 -0
- data/stdlib/objspace/0/objspace.rbs +149 -90
- data/stdlib/openssl/0/openssl.rbs +8108 -71
- data/stdlib/optparse/0/optparse.rbs +487 -19
- data/stdlib/pathname/0/pathname.rbs +425 -124
- data/stdlib/prettyprint/0/prettyprint.rbs +120 -99
- data/stdlib/prime/0/integer-extension.rbs +20 -2
- data/stdlib/prime/0/prime.rbs +88 -21
- data/stdlib/pstore/0/pstore.rbs +102 -0
- data/stdlib/pty/0/pty.rbs +64 -14
- data/stdlib/resolv/0/resolv.rbs +420 -31
- data/stdlib/rubygems/0/basic_specification.rbs +4 -1
- data/stdlib/rubygems/0/config_file.rbs +33 -1
- data/stdlib/rubygems/0/dependency_installer.rbs +4 -3
- data/stdlib/rubygems/0/installer.rbs +13 -1
- data/stdlib/rubygems/0/path_support.rbs +4 -1
- data/stdlib/rubygems/0/platform.rbs +5 -1
- data/stdlib/rubygems/0/request_set.rbs +44 -2
- data/stdlib/rubygems/0/requirement.rbs +65 -2
- data/stdlib/rubygems/0/rubygems.rbs +407 -0
- data/stdlib/rubygems/0/source_list.rbs +13 -0
- data/stdlib/rubygems/0/specification.rbs +21 -1
- data/stdlib/rubygems/0/stream_ui.rbs +3 -1
- data/stdlib/rubygems/0/uninstaller.rbs +8 -1
- data/stdlib/rubygems/0/version.rbs +60 -157
- data/stdlib/securerandom/0/securerandom.rbs +44 -0
- data/stdlib/set/0/set.rbs +420 -106
- data/stdlib/shellwords/0/shellwords.rbs +55 -77
- data/stdlib/singleton/0/singleton.rbs +20 -0
- data/stdlib/socket/0/addrinfo.rbs +210 -9
- data/stdlib/socket/0/basic_socket.rbs +103 -11
- data/stdlib/socket/0/ip_socket.rbs +31 -9
- data/stdlib/socket/0/socket.rbs +586 -38
- data/stdlib/socket/0/tcp_server.rbs +22 -2
- data/stdlib/socket/0/tcp_socket.rbs +12 -1
- data/stdlib/socket/0/udp_socket.rbs +25 -2
- data/stdlib/socket/0/unix_server.rbs +22 -2
- data/stdlib/socket/0/unix_socket.rbs +45 -5
- data/stdlib/strscan/0/string_scanner.rbs +210 -9
- data/stdlib/tempfile/0/tempfile.rbs +58 -10
- data/stdlib/time/0/time.rbs +208 -116
- data/stdlib/timeout/0/timeout.rbs +10 -0
- data/stdlib/tmpdir/0/tmpdir.rbs +13 -4
- data/stdlib/tsort/0/cyclic.rbs +1 -0
- data/stdlib/tsort/0/interfaces.rbs +1 -0
- data/stdlib/tsort/0/tsort.rbs +42 -0
- data/stdlib/uri/0/common.rbs +57 -8
- data/stdlib/uri/0/file.rbs +55 -109
- data/stdlib/uri/0/ftp.rbs +6 -3
- data/stdlib/uri/0/generic.rbs +556 -327
- data/stdlib/uri/0/http.rbs +26 -115
- data/stdlib/uri/0/https.rbs +8 -102
- data/stdlib/uri/0/ldap.rbs +143 -137
- data/stdlib/uri/0/ldaps.rbs +8 -102
- data/stdlib/uri/0/mailto.rbs +3 -0
- data/stdlib/uri/0/rfc2396_parser.rbs +66 -26
- data/stdlib/uri/0/ws.rbs +6 -3
- data/stdlib/uri/0/wss.rbs +5 -3
- data/stdlib/yaml/0/dbm.rbs +151 -87
- data/stdlib/yaml/0/store.rbs +6 -0
- data/stdlib/zlib/0/zlib.rbs +90 -31
- metadata +17 -5
- data/lib/rbs/location.rb +0 -221
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# <!-- rdoc-file=ext/bigdecimal/lib/bigdecimal/math.rb -->
|
|
1
2
|
# Provides mathematical functions.
|
|
2
3
|
#
|
|
3
4
|
# Example:
|
|
@@ -10,22 +11,34 @@
|
|
|
10
11
|
# puts sin(a,100) # => 0.99999999999999999999......e0
|
|
11
12
|
#
|
|
12
13
|
module BigMath
|
|
14
|
+
# <!--
|
|
15
|
+
# rdoc-file=ext/bigdecimal/lib/bigdecimal/math.rb
|
|
16
|
+
# - E(numeric) -> BigDecimal
|
|
17
|
+
# -->
|
|
13
18
|
# Computes e (the base of natural logarithms) to the specified number of digits
|
|
14
19
|
# of precision, `numeric`.
|
|
15
20
|
#
|
|
16
21
|
# BigMath.E(10).to_s
|
|
17
22
|
# #=> "0.271828182845904523536028752390026306410273e1"
|
|
18
23
|
#
|
|
19
|
-
def self
|
|
24
|
+
def self?.E: (Numeric prec) -> BigDecimal
|
|
20
25
|
|
|
26
|
+
# <!--
|
|
27
|
+
# rdoc-file=ext/bigdecimal/lib/bigdecimal/math.rb
|
|
28
|
+
# - PI(numeric) -> BigDecimal
|
|
29
|
+
# -->
|
|
21
30
|
# Computes the value of pi to the specified number of digits of precision,
|
|
22
31
|
# `numeric`.
|
|
23
32
|
#
|
|
24
33
|
# BigMath.PI(10).to_s
|
|
25
34
|
# #=> "0.3141592653589793238462643388813853786957412e1"
|
|
26
35
|
#
|
|
27
|
-
def self
|
|
36
|
+
def self?.PI: (Numeric prec) -> BigDecimal
|
|
28
37
|
|
|
38
|
+
# <!--
|
|
39
|
+
# rdoc-file=ext/bigdecimal/lib/bigdecimal/math.rb
|
|
40
|
+
# - atan(decimal, numeric) -> BigDecimal
|
|
41
|
+
# -->
|
|
29
42
|
# Computes the arctangent of `decimal` to the specified number of digits of
|
|
30
43
|
# precision, `numeric`.
|
|
31
44
|
#
|
|
@@ -34,8 +47,12 @@ module BigMath
|
|
|
34
47
|
# BigMath.atan(BigDecimal('-1'), 16).to_s
|
|
35
48
|
# #=> "-0.785398163397448309615660845819878471907514682065e0"
|
|
36
49
|
#
|
|
37
|
-
def self
|
|
50
|
+
def self?.atan: (BigDecimal x, Numeric prec) -> BigDecimal
|
|
38
51
|
|
|
52
|
+
# <!--
|
|
53
|
+
# rdoc-file=ext/bigdecimal/lib/bigdecimal/math.rb
|
|
54
|
+
# - cos(decimal, numeric) -> BigDecimal
|
|
55
|
+
# -->
|
|
39
56
|
# Computes the cosine of `decimal` to the specified number of digits of
|
|
40
57
|
# precision, `numeric`.
|
|
41
58
|
#
|
|
@@ -44,8 +61,12 @@ module BigMath
|
|
|
44
61
|
# BigMath.cos(BigMath.PI(4), 16).to_s
|
|
45
62
|
# #=> "-0.999999999999999999999999999999856613163740061349e0"
|
|
46
63
|
#
|
|
47
|
-
def self
|
|
64
|
+
def self?.cos: (BigDecimal x, Numeric prec) -> BigDecimal
|
|
48
65
|
|
|
66
|
+
# <!--
|
|
67
|
+
# rdoc-file=ext/bigdecimal/bigdecimal.c
|
|
68
|
+
# - BigMath.exp(decimal, numeric) -> BigDecimal
|
|
69
|
+
# -->
|
|
49
70
|
# Computes the value of e (the base of natural logarithms) raised to the power
|
|
50
71
|
# of `decimal`, to the specified number of digits of precision.
|
|
51
72
|
#
|
|
@@ -53,8 +74,12 @@ module BigMath
|
|
|
53
74
|
#
|
|
54
75
|
# If `decimal` is NaN, returns NaN.
|
|
55
76
|
#
|
|
56
|
-
def self
|
|
77
|
+
def self?.exp: (BigDecimal, Numeric prec) -> BigDecimal
|
|
57
78
|
|
|
79
|
+
# <!--
|
|
80
|
+
# rdoc-file=ext/bigdecimal/bigdecimal.c
|
|
81
|
+
# - BigMath.log(decimal, numeric) -> BigDecimal
|
|
82
|
+
# -->
|
|
58
83
|
# Computes the natural logarithm of `decimal` to the specified number of digits
|
|
59
84
|
# of precision, `numeric`.
|
|
60
85
|
#
|
|
@@ -64,8 +89,12 @@ module BigMath
|
|
|
64
89
|
#
|
|
65
90
|
# If `decimal` is NaN, returns NaN.
|
|
66
91
|
#
|
|
67
|
-
def self
|
|
92
|
+
def self?.log: (BigDecimal, Numeric prec) -> BigDecimal
|
|
68
93
|
|
|
94
|
+
# <!--
|
|
95
|
+
# rdoc-file=ext/bigdecimal/lib/bigdecimal/math.rb
|
|
96
|
+
# - sin(decimal, numeric) -> BigDecimal
|
|
97
|
+
# -->
|
|
69
98
|
# Computes the sine of `decimal` to the specified number of digits of precision,
|
|
70
99
|
# `numeric`.
|
|
71
100
|
#
|
|
@@ -74,69 +103,17 @@ module BigMath
|
|
|
74
103
|
# BigMath.sin(BigMath.PI(5)/4, 5).to_s
|
|
75
104
|
# #=> "0.70710678118654752440082036563292800375e0"
|
|
76
105
|
#
|
|
77
|
-
def self
|
|
106
|
+
def self?.sin: (BigDecimal x, Numeric prec) -> BigDecimal
|
|
78
107
|
|
|
108
|
+
# <!--
|
|
109
|
+
# rdoc-file=ext/bigdecimal/lib/bigdecimal/math.rb
|
|
110
|
+
# - sqrt(decimal, numeric) -> BigDecimal
|
|
111
|
+
# -->
|
|
79
112
|
# Computes the square root of `decimal` to the specified number of digits of
|
|
80
113
|
# precision, `numeric`.
|
|
81
114
|
#
|
|
82
115
|
# BigMath.sqrt(BigDecimal('2'), 16).to_s
|
|
83
116
|
# #=> "0.1414213562373095048801688724e1"
|
|
84
117
|
#
|
|
85
|
-
def self
|
|
86
|
-
|
|
87
|
-
private
|
|
88
|
-
|
|
89
|
-
# Computes e (the base of natural logarithms) to the specified number of digits
|
|
90
|
-
# of precision, `numeric`.
|
|
91
|
-
#
|
|
92
|
-
# BigMath.E(10).to_s
|
|
93
|
-
# #=> "0.271828182845904523536028752390026306410273e1"
|
|
94
|
-
#
|
|
95
|
-
def E: (Numeric prec) -> BigDecimal
|
|
96
|
-
|
|
97
|
-
# Computes the value of pi to the specified number of digits of precision,
|
|
98
|
-
# `numeric`.
|
|
99
|
-
#
|
|
100
|
-
# BigMath.PI(10).to_s
|
|
101
|
-
# #=> "0.3141592653589793238462643388813853786957412e1"
|
|
102
|
-
#
|
|
103
|
-
def PI: (Numeric prec) -> BigDecimal
|
|
104
|
-
|
|
105
|
-
# Computes the arctangent of `decimal` to the specified number of digits of
|
|
106
|
-
# precision, `numeric`.
|
|
107
|
-
#
|
|
108
|
-
# If `decimal` is NaN, returns NaN.
|
|
109
|
-
#
|
|
110
|
-
# BigMath.atan(BigDecimal('-1'), 16).to_s
|
|
111
|
-
# #=> "-0.785398163397448309615660845819878471907514682065e0"
|
|
112
|
-
#
|
|
113
|
-
def atan: (BigDecimal x, Numeric prec) -> BigDecimal
|
|
114
|
-
|
|
115
|
-
# Computes the cosine of `decimal` to the specified number of digits of
|
|
116
|
-
# precision, `numeric`.
|
|
117
|
-
#
|
|
118
|
-
# If `decimal` is Infinity or NaN, returns NaN.
|
|
119
|
-
#
|
|
120
|
-
# BigMath.cos(BigMath.PI(4), 16).to_s
|
|
121
|
-
# #=> "-0.999999999999999999999999999999856613163740061349e0"
|
|
122
|
-
#
|
|
123
|
-
def cos: (BigDecimal x, Numeric prec) -> BigDecimal
|
|
124
|
-
|
|
125
|
-
# Computes the sine of `decimal` to the specified number of digits of precision,
|
|
126
|
-
# `numeric`.
|
|
127
|
-
#
|
|
128
|
-
# If `decimal` is Infinity or NaN, returns NaN.
|
|
129
|
-
#
|
|
130
|
-
# BigMath.sin(BigMath.PI(5)/4, 5).to_s
|
|
131
|
-
# #=> "0.70710678118654752440082036563292800375e0"
|
|
132
|
-
#
|
|
133
|
-
def sin: (BigDecimal x, Numeric prec) -> BigDecimal
|
|
134
|
-
|
|
135
|
-
# Computes the square root of `decimal` to the specified number of digits of
|
|
136
|
-
# precision, `numeric`.
|
|
137
|
-
#
|
|
138
|
-
# BigMath.sqrt(BigDecimal('2'), 16).to_s
|
|
139
|
-
# #=> "0.1414213562373095048801688724e1"
|
|
140
|
-
#
|
|
141
|
-
def sqrt: (BigDecimal x, Numeric prec) -> BigDecimal
|
|
118
|
+
def self?.sqrt: (BigDecimal x, Numeric prec) -> BigDecimal
|
|
142
119
|
end
|
data/stdlib/cgi/0/core.rbs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# <!-- rdoc-file=lib/cgi.rb -->
|
|
1
2
|
# ## Overview
|
|
2
3
|
#
|
|
3
4
|
# The Common Gateway Interface (CGI) is a simple protocol for passing an HTTP
|
|
@@ -266,7 +267,13 @@
|
|
|
266
267
|
# include CGI::Util
|
|
267
268
|
# escapeHTML('Usage: foo "bar" <baz>')
|
|
268
269
|
# h('Usage: foo "bar" <baz>') # alias
|
|
270
|
+
#
|
|
269
271
|
class CGI
|
|
272
|
+
# <!--
|
|
273
|
+
# rdoc-file=lib/cgi/core.rb
|
|
274
|
+
# - CGI.new(tag_maker) { block }
|
|
275
|
+
# - CGI.new(options_hash = {}) { block }
|
|
276
|
+
# -->
|
|
270
277
|
# Create a new CGI instance.
|
|
271
278
|
#
|
|
272
279
|
# `tag_maker`
|
|
@@ -343,16 +350,31 @@ class CGI
|
|
|
343
350
|
def initialize: (?String tag_maker) ?{ (String name, String value) -> void } -> void
|
|
344
351
|
| (Hash[Symbol, untyped] options_hash) ?{ (String name, String value) -> void } -> void
|
|
345
352
|
|
|
353
|
+
# <!-- rdoc-file=lib/cgi/core.rb -->
|
|
354
|
+
# Return the accept character set for this CGI instance.
|
|
355
|
+
#
|
|
346
356
|
attr_reader accept_charset: String
|
|
347
357
|
|
|
358
|
+
# <!--
|
|
359
|
+
# rdoc-file=lib/cgi/core.rb
|
|
360
|
+
# - accept_charset()
|
|
361
|
+
# -->
|
|
348
362
|
# Return the accept character set for all new CGI instances.
|
|
349
363
|
#
|
|
350
364
|
def self.accept_charset: () -> String
|
|
351
365
|
|
|
366
|
+
# <!--
|
|
367
|
+
# rdoc-file=lib/cgi/core.rb
|
|
368
|
+
# - accept_charset=(accept_charset)
|
|
369
|
+
# -->
|
|
352
370
|
# Set the accept character set for all new CGI instances.
|
|
353
371
|
#
|
|
354
372
|
def self.accept_charset=: (String accept_charset) -> String
|
|
355
373
|
|
|
374
|
+
# <!--
|
|
375
|
+
# rdoc-file=lib/cgi/core.rb
|
|
376
|
+
# - parse(query)
|
|
377
|
+
# -->
|
|
356
378
|
# Parse an HTTP query string into a hash of key=>value pairs.
|
|
357
379
|
#
|
|
358
380
|
# params = CGI.parse("query_string")
|
|
@@ -363,6 +385,7 @@ class CGI
|
|
|
363
385
|
|
|
364
386
|
public
|
|
365
387
|
|
|
388
|
+
# <!-- rdoc-file=lib/cgi/core.rb -->
|
|
366
389
|
# This method is an alias for #http_header, when HTML5 tag maker is inactive.
|
|
367
390
|
#
|
|
368
391
|
# NOTE: use #http_header to create HTTP header blocks, this alias is only
|
|
@@ -372,6 +395,11 @@ class CGI
|
|
|
372
395
|
#
|
|
373
396
|
alias header http_header
|
|
374
397
|
|
|
398
|
+
# <!--
|
|
399
|
+
# rdoc-file=lib/cgi/core.rb
|
|
400
|
+
# - http_header(content_type_string="text/html")
|
|
401
|
+
# - http_header(headers_hash)
|
|
402
|
+
# -->
|
|
375
403
|
# Create an HTTP header block as a string.
|
|
376
404
|
#
|
|
377
405
|
# Includes the empty line that ends the header block.
|
|
@@ -487,6 +515,11 @@ class CGI
|
|
|
487
515
|
|
|
488
516
|
def nph?: () -> boolish
|
|
489
517
|
|
|
518
|
+
# <!--
|
|
519
|
+
# rdoc-file=lib/cgi/core.rb
|
|
520
|
+
# - cgi.out(content_type_string='text/html')
|
|
521
|
+
# - cgi.out(headers_hash)
|
|
522
|
+
# -->
|
|
490
523
|
# Print an HTTP header and body to $DEFAULT_OUTPUT ($>)
|
|
491
524
|
#
|
|
492
525
|
# `content_type_string`
|
|
@@ -551,6 +584,10 @@ class CGI
|
|
|
551
584
|
def out: (?String content_type_string) { () -> String } -> void
|
|
552
585
|
| (Hash[String | Symbol, untyped] headers_hash) { () -> String } -> void
|
|
553
586
|
|
|
587
|
+
# <!--
|
|
588
|
+
# rdoc-file=lib/cgi/core.rb
|
|
589
|
+
# - print(*options)
|
|
590
|
+
# -->
|
|
554
591
|
# Print an argument or list of arguments to the default output stream
|
|
555
592
|
#
|
|
556
593
|
# cgi = CGI.new
|
|
@@ -560,34 +597,56 @@ class CGI
|
|
|
560
597
|
|
|
561
598
|
private
|
|
562
599
|
|
|
600
|
+
# <!--
|
|
601
|
+
# rdoc-file=lib/cgi/core.rb
|
|
602
|
+
# - stdinput()
|
|
603
|
+
# -->
|
|
563
604
|
# Synonym for $stdin.
|
|
564
605
|
#
|
|
565
606
|
def stdinput: () -> ::IO
|
|
566
607
|
|
|
608
|
+
# <!--
|
|
609
|
+
# rdoc-file=lib/cgi/core.rb
|
|
610
|
+
# - stdoutput()
|
|
611
|
+
# -->
|
|
567
612
|
# Synonym for $stdout.
|
|
568
613
|
#
|
|
569
614
|
def stdoutput: () -> ::IO
|
|
570
615
|
end
|
|
571
616
|
|
|
617
|
+
# <!-- rdoc-file=lib/cgi/core.rb -->
|
|
572
618
|
# String for carriage return
|
|
619
|
+
#
|
|
573
620
|
CGI::CR: String
|
|
574
621
|
|
|
622
|
+
# <!-- rdoc-file=lib/cgi/core.rb -->
|
|
575
623
|
# Standard internet newline sequence
|
|
624
|
+
#
|
|
576
625
|
CGI::EOL: String
|
|
577
626
|
|
|
627
|
+
# <!-- rdoc-file=lib/cgi/core.rb -->
|
|
578
628
|
# HTTP status codes.
|
|
629
|
+
#
|
|
579
630
|
CGI::HTTP_STATUS: Hash[String, String]
|
|
580
631
|
|
|
632
|
+
# <!-- rdoc-file=lib/cgi/core.rb -->
|
|
581
633
|
# String for linefeed
|
|
634
|
+
#
|
|
582
635
|
CGI::LF: String
|
|
583
636
|
|
|
637
|
+
# <!-- rdoc-file=lib/cgi/core.rb -->
|
|
584
638
|
# Maximum number of request parameters when multipart
|
|
639
|
+
#
|
|
585
640
|
CGI::MAX_MULTIPART_COUNT: Integer
|
|
586
641
|
|
|
642
|
+
# <!-- rdoc-file=lib/cgi/core.rb -->
|
|
587
643
|
# Whether processing will be required in binary vs text
|
|
644
|
+
#
|
|
588
645
|
CGI::NEEDS_BINMODE: bool
|
|
589
646
|
|
|
647
|
+
# <!-- rdoc-file=lib/cgi/core.rb -->
|
|
590
648
|
# Path separators in different environments.
|
|
649
|
+
#
|
|
591
650
|
CGI::PATH_SEPARATOR: Hash[String, String]
|
|
592
651
|
|
|
593
652
|
CGI::REVISION: String
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
# <!-- rdoc-file=ext/coverage/coverage.c -->
|
|
1
2
|
# Coverage provides coverage measurement feature for Ruby. This feature is
|
|
2
3
|
# experimental, so these APIs may be changed in future.
|
|
3
4
|
#
|
|
5
|
+
# Caveat: Currently, only process-global coverage measurement is supported. You
|
|
6
|
+
# cannot measure per-thread covearge.
|
|
7
|
+
#
|
|
4
8
|
# # Usage
|
|
5
9
|
#
|
|
6
10
|
# 1. require "coverage"
|
|
@@ -12,7 +16,7 @@
|
|
|
12
16
|
# disabled for this line (lines like `else` and `end`).
|
|
13
17
|
#
|
|
14
18
|
#
|
|
15
|
-
# #
|
|
19
|
+
# # Examples
|
|
16
20
|
#
|
|
17
21
|
# [foo.rb]
|
|
18
22
|
# s = 0
|
|
@@ -32,9 +36,129 @@
|
|
|
32
36
|
# require "foo.rb"
|
|
33
37
|
# p Coverage.result #=> {"foo.rb"=>[1, 1, 10, nil, nil, 1, 1, nil, 0, nil]}
|
|
34
38
|
#
|
|
39
|
+
# ## Lines Coverage
|
|
40
|
+
#
|
|
41
|
+
# If a coverage mode is not explicitly specified when starting coverage, lines
|
|
42
|
+
# coverage is what will run. It reports the number of line executions for each
|
|
43
|
+
# line.
|
|
44
|
+
#
|
|
45
|
+
# require "coverage"
|
|
46
|
+
# Coverage.start(lines: true)
|
|
47
|
+
# require "foo.rb"
|
|
48
|
+
# p Coverage.result #=> {"foo.rb"=>{:lines=>[1, 1, 10, nil, nil, 1, 1, nil, 0, nil]}}
|
|
49
|
+
#
|
|
50
|
+
# The value of the lines coverage result is an array containing how many times
|
|
51
|
+
# each line was executed. Order in this array is important. For example, the
|
|
52
|
+
# first item in this array, at index 0, reports how many times line 1 of this
|
|
53
|
+
# file was executed while coverage was run (which, in this example, is one
|
|
54
|
+
# time).
|
|
55
|
+
#
|
|
56
|
+
# A `nil` value means coverage is disabled for this line (lines like `else` and
|
|
57
|
+
# `end`).
|
|
58
|
+
#
|
|
59
|
+
# ## Oneshot Lines Coverage
|
|
60
|
+
#
|
|
61
|
+
# Oneshot lines coverage tracks and reports on the executed lines while coverage
|
|
62
|
+
# is running. It will not report how many times a line was executed, only that
|
|
63
|
+
# it was executed.
|
|
64
|
+
#
|
|
65
|
+
# require "coverage"
|
|
66
|
+
# Coverage.start(oneshot_lines: true)
|
|
67
|
+
# require "foo.rb"
|
|
68
|
+
# p Coverage.result #=> {"foo.rb"=>{:oneshot_lines=>[1, 2, 3, 6, 7]}}
|
|
69
|
+
#
|
|
70
|
+
# The value of the oneshot lines coverage result is an array containing the line
|
|
71
|
+
# numbers that were executed.
|
|
72
|
+
#
|
|
73
|
+
# ## Branches Coverage
|
|
74
|
+
#
|
|
75
|
+
# Branches coverage reports how many times each branch within each conditional
|
|
76
|
+
# was executed.
|
|
77
|
+
#
|
|
78
|
+
# require "coverage"
|
|
79
|
+
# Coverage.start(branches: true)
|
|
80
|
+
# require "foo.rb"
|
|
81
|
+
# p Coverage.result #=> {"foo.rb"=>{:branches=>{[:if, 0, 6, 0, 10, 3]=>{[:then, 1, 7, 2, 7, 7]=>1, [:else, 2, 9, 2, 9, 7]=>0}}}}
|
|
82
|
+
#
|
|
83
|
+
# Each entry within the branches hash is a conditional, the value of which is
|
|
84
|
+
# another hash where each entry is a branch in that conditional. The values are
|
|
85
|
+
# the number of times the method was executed, and the keys are identifying
|
|
86
|
+
# information about the branch.
|
|
87
|
+
#
|
|
88
|
+
# The information that makes up each key identifying branches or conditionals is
|
|
89
|
+
# the following, from left to right:
|
|
90
|
+
#
|
|
91
|
+
# 1. A label for the type of branch or conditional.
|
|
92
|
+
# 2. A unique identifier.
|
|
93
|
+
# 3. The starting line number it appears on in the file.
|
|
94
|
+
# 4. The starting column number it appears on in the file.
|
|
95
|
+
# 5. The ending line number it appears on in the file.
|
|
96
|
+
# 6. The ending column number it appears on in the file.
|
|
97
|
+
#
|
|
98
|
+
#
|
|
99
|
+
# ## Methods Coverage
|
|
100
|
+
#
|
|
101
|
+
# Methods coverage reports how many times each method was executed.
|
|
102
|
+
#
|
|
103
|
+
# [foo_method.rb]
|
|
104
|
+
# class Greeter
|
|
105
|
+
# def greet
|
|
106
|
+
# "welcome!"
|
|
107
|
+
# end
|
|
108
|
+
# end
|
|
109
|
+
#
|
|
110
|
+
# def hello
|
|
111
|
+
# "Hi"
|
|
112
|
+
# end
|
|
113
|
+
#
|
|
114
|
+
# hello()
|
|
115
|
+
# Greeter.new.greet()
|
|
116
|
+
# [EOF]
|
|
117
|
+
#
|
|
118
|
+
# require "coverage"
|
|
119
|
+
# Coverage.start(methods: true)
|
|
120
|
+
# require "foo_method.rb"
|
|
121
|
+
# p Coverage.result #=> {"foo_method.rb"=>{:methods=>{[Object, :hello, 7, 0, 9, 3]=>1, [Greeter, :greet, 2, 2, 4, 5]=>1}}}
|
|
122
|
+
#
|
|
123
|
+
# Each entry within the methods hash represents a method. The values in this
|
|
124
|
+
# hash are the number of times the method was executed, and the keys are
|
|
125
|
+
# identifying information about the method.
|
|
126
|
+
#
|
|
127
|
+
# The information that makes up each key identifying a method is the following,
|
|
128
|
+
# from left to right:
|
|
129
|
+
#
|
|
130
|
+
# 1. The class.
|
|
131
|
+
# 2. The method name.
|
|
132
|
+
# 3. The starting line number the method appears on in the file.
|
|
133
|
+
# 4. The starting column number the method appears on in the file.
|
|
134
|
+
# 5. The ending line number the method appears on in the file.
|
|
135
|
+
# 6. The ending column number the method appears on in the file.
|
|
136
|
+
#
|
|
137
|
+
#
|
|
138
|
+
# ## All Coverage Modes
|
|
139
|
+
#
|
|
140
|
+
# You can also run all modes of coverage simultaneously with this shortcut. Note
|
|
141
|
+
# that running all coverage modes does not run both lines and oneshot lines.
|
|
142
|
+
# Those modes cannot be run simultaneously. Lines coverage is run in this case,
|
|
143
|
+
# because you can still use it to determine whether or not a line was executed.
|
|
144
|
+
#
|
|
145
|
+
# require "coverage"
|
|
146
|
+
# Coverage.start(:all)
|
|
147
|
+
# require "foo.rb"
|
|
148
|
+
# p Coverage.result #=> {"foo.rb"=>{:lines=>[1, 1, 10, nil, nil, 1, 1, nil, 0, nil], :branches=>{[:if, 0, 6, 0, 10, 3]=>{[:then, 1, 7, 2, 7, 7]=>1, [:else, 2, 9, 2, 9, 7]=>0}}, :methods=>{}}}
|
|
149
|
+
#
|
|
35
150
|
module Coverage
|
|
151
|
+
# <!--
|
|
152
|
+
# rdoc-file=ext/coverage/lib/coverage.rb
|
|
153
|
+
# - line_stub(file)
|
|
154
|
+
# -->
|
|
155
|
+
#
|
|
36
156
|
def self.line_stub: () -> Array[Integer?]
|
|
37
157
|
|
|
158
|
+
# <!--
|
|
159
|
+
# rdoc-file=ext/coverage/coverage.c
|
|
160
|
+
# - Coverage.peek_result => hash
|
|
161
|
+
# -->
|
|
38
162
|
# Returns a hash that contains filename as key and coverage array as value. This
|
|
39
163
|
# is the same as `Coverage.result(stop: false, clear: false)`.
|
|
40
164
|
#
|
|
@@ -45,18 +169,56 @@ module Coverage
|
|
|
45
169
|
#
|
|
46
170
|
def self.peek_result: () -> Hash[String, untyped]
|
|
47
171
|
|
|
172
|
+
# <!--
|
|
173
|
+
# rdoc-file=ext/coverage/coverage.c
|
|
174
|
+
# - Coverage.result(stop: true, clear: true) => hash
|
|
175
|
+
# -->
|
|
48
176
|
# Returns a hash that contains filename as key and coverage array as value. If
|
|
49
177
|
# `clear` is true, it clears the counters to zero. If `stop` is true, it
|
|
50
178
|
# disables coverage measurement.
|
|
51
179
|
#
|
|
52
180
|
def self.result: (?stop: boolish, ?clear: boolish) -> Hash[String, untyped]
|
|
53
181
|
|
|
182
|
+
# <!--
|
|
183
|
+
# rdoc-file=ext/coverage/coverage.c
|
|
184
|
+
# - Coverage.running? => bool
|
|
185
|
+
# -->
|
|
54
186
|
# Returns true if coverage stats are currently being collected (after
|
|
55
187
|
# Coverage.start call, but before Coverage.result call)
|
|
56
188
|
#
|
|
57
189
|
def self.running?: () -> bool
|
|
58
190
|
|
|
59
|
-
#
|
|
191
|
+
# <!--
|
|
192
|
+
# rdoc-file=ext/coverage/coverage.c
|
|
193
|
+
# - Coverage.start => nil
|
|
194
|
+
# - Coverage.start(:all) => nil
|
|
195
|
+
# - Coverage.start(lines: bool, branches: bool, methods: bool) => nil
|
|
196
|
+
# - Coverage.start(oneshot_lines: true) => nil
|
|
197
|
+
# -->
|
|
198
|
+
# Enables the coverage measurement. See the documentation of Coverage class in
|
|
199
|
+
# detail. This is equivalent to Coverage.setup and Coverage.resume.
|
|
60
200
|
#
|
|
61
201
|
def self.start: (?lines: boolish, ?branches: boolish, ?methods: boolish, ?oneshot_lines: boolish) -> nil
|
|
202
|
+
|
|
203
|
+
# <!--
|
|
204
|
+
# rdoc-file=ext/coverage/coverage.c
|
|
205
|
+
# - Coverage.resume => nil
|
|
206
|
+
# -->
|
|
207
|
+
# Start/resume the coverage measurement.
|
|
208
|
+
#
|
|
209
|
+
# Caveat: Currently, only process-global coverage measurement is supported. You
|
|
210
|
+
# cannot measure per-thread covearge. If your process has multiple thread, using
|
|
211
|
+
# Coverage.resume/suspend to capture code coverage executed from only a limited
|
|
212
|
+
# code block, may yield misleading results.
|
|
213
|
+
#
|
|
214
|
+
def self.resume: () -> nil
|
|
215
|
+
|
|
216
|
+
# <!--
|
|
217
|
+
# rdoc-file=ext/coverage/coverage.c
|
|
218
|
+
# - Coverage.suspend => nil
|
|
219
|
+
# -->
|
|
220
|
+
# Suspend the coverage measurement. You can use Coverage.resume to restart the
|
|
221
|
+
# measurement.
|
|
222
|
+
#
|
|
223
|
+
def self.suspend: () -> nil
|
|
62
224
|
end
|