rbs 3.6.1 → 3.9.5
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/comments.yml +2 -2
- data/.github/workflows/dependabot.yml +1 -1
- data/.github/workflows/ruby.yml +34 -10
- data/.github/workflows/windows.yml +20 -3
- data/.gitignore +1 -0
- data/.rubocop.yml +26 -1
- data/CHANGELOG.md +241 -0
- data/Rakefile +54 -4
- data/config.yml +317 -0
- data/core/array.rbs +1756 -1591
- data/core/basic_object.rbs +38 -35
- data/core/comparable.rbs +1 -1
- data/core/complex.rbs +166 -94
- data/core/data.rbs +2 -2
- data/core/dir.rbs +2 -18
- data/core/encoding.rbs +12 -32
- data/core/enumerable.rbs +270 -266
- data/core/enumerator.rbs +14 -4
- data/core/env.rbs +1 -1
- data/core/errno.rbs +33 -16
- data/core/errors.rbs +6 -2
- data/core/exception.rbs +342 -167
- data/core/fiber.rbs +3 -2
- data/core/file.rbs +26 -75
- data/core/float.rbs +125 -72
- data/core/gc.rbs +158 -42
- data/core/hash.rbs +122 -143
- data/core/integer.rbs +79 -50
- data/core/io/buffer.rbs +49 -43
- data/core/io.rbs +108 -151
- data/core/kernel.rbs +341 -209
- data/core/match_data.rbs +76 -2
- data/core/math.rbs +0 -36
- data/core/method.rbs +2 -2
- data/core/module.rbs +32 -27
- data/core/nil_class.rbs +2 -2
- data/core/numeric.rbs +101 -104
- data/core/object.rbs +1 -5
- data/core/object_space/weak_key_map.rbs +3 -4
- data/core/object_space.rbs +3 -3
- data/core/proc.rbs +82 -14
- data/core/process.rbs +110 -58
- data/core/ractor.rbs +57 -4
- data/core/range.rbs +114 -87
- data/core/rational.rbs +0 -2
- data/core/rbs/unnamed/argf.rbs +237 -36
- data/core/rbs/unnamed/env_class.rbs +35 -53
- data/core/rbs/unnamed/random.rbs +1 -2
- data/core/regexp.rbs +10 -56
- data/core/ruby_vm.rbs +88 -9
- data/core/rubygems/config_file.rbs +3 -0
- data/core/rubygems/errors.rbs +3 -6
- data/core/rubygems/platform.rbs +0 -9
- data/core/rubygems/rubygems.rbs +3 -6
- data/core/rubygems/version.rbs +8 -8
- data/core/set.rbs +4 -16
- data/core/string.rbs +271 -264
- data/core/struct.rbs +6 -18
- data/core/symbol.rbs +14 -21
- data/core/thread.rbs +32 -35
- data/core/time.rbs +131 -50
- data/core/trace_point.rbs +124 -113
- data/core/true_class.rbs +0 -1
- data/core/unbound_method.rbs +1 -1
- data/core/warning.rbs +9 -2
- data/docs/architecture.md +1 -1
- data/docs/syntax.md +17 -10
- data/ext/rbs_extension/extconf.rb +11 -0
- data/ext/rbs_extension/location.c +61 -29
- data/ext/rbs_extension/location.h +4 -3
- data/ext/rbs_extension/main.c +23 -1
- data/ext/rbs_extension/parser.c +506 -517
- data/ext/rbs_extension/parserstate.c +109 -30
- data/ext/rbs_extension/parserstate.h +6 -4
- data/ext/rbs_extension/rbs_extension.h +1 -10
- data/{ext/rbs_extension → include/rbs}/constants.h +21 -19
- data/include/rbs/ruby_objs.h +72 -0
- data/include/rbs/util/rbs_constant_pool.h +219 -0
- data/include/rbs.h +7 -0
- data/lib/rbs/annotate/annotations.rb +3 -3
- data/lib/rbs/annotate/rdoc_source.rb +2 -2
- data/lib/rbs/ast/declarations.rb +9 -4
- data/lib/rbs/ast/directives.rb +10 -0
- data/lib/rbs/ast/members.rb +2 -0
- data/lib/rbs/ast/type_param.rb +2 -12
- data/lib/rbs/cli/diff.rb +3 -3
- data/lib/rbs/cli/validate.rb +2 -1
- data/lib/rbs/cli.rb +16 -16
- data/lib/rbs/collection/config/lockfile_generator.rb +58 -8
- data/lib/rbs/collection/config.rb +5 -3
- data/lib/rbs/collection/sources/rubygems.rb +1 -1
- data/lib/rbs/collection.rb +1 -0
- data/lib/rbs/definition.rb +51 -34
- data/lib/rbs/definition_builder/ancestor_builder.rb +5 -3
- data/lib/rbs/definition_builder.rb +83 -24
- data/lib/rbs/environment.rb +33 -18
- data/lib/rbs/environment_loader.rb +6 -1
- data/lib/rbs/errors.rb +24 -0
- data/lib/rbs/locator.rb +2 -0
- data/lib/rbs/method_type.rb +2 -0
- data/lib/rbs/namespace.rb +1 -0
- data/lib/rbs/parser_aux.rb +40 -3
- data/lib/rbs/prototype/rb.rb +20 -12
- data/lib/rbs/prototype/rbi.rb +11 -6
- data/lib/rbs/prototype/runtime/value_object_generator.rb +7 -5
- data/lib/rbs/prototype/runtime.rb +7 -5
- data/lib/rbs/subtractor.rb +3 -3
- data/lib/rbs/test/hook.rb +47 -42
- data/lib/rbs/test/type_check.rb +7 -5
- data/lib/rbs/type_name.rb +14 -9
- data/lib/rbs/types.rb +63 -14
- data/lib/rbs/unit_test/spy.rb +4 -2
- data/lib/rbs/unit_test/type_assertions.rb +19 -13
- data/lib/rbs/unit_test/with_aliases.rb +3 -1
- data/lib/rbs/validator.rb +7 -1
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs/writer.rb +10 -5
- data/lib/rbs.rb +1 -0
- data/lib/rdoc_plugin/parser.rb +2 -2
- data/rbs.gemspec +6 -2
- data/sig/ancestor_graph.rbs +5 -5
- data/sig/annotate/rdoc_source.rbs +2 -0
- data/sig/cli.rbs +2 -0
- data/sig/collection/config/lockfile_generator.rbs +9 -1
- data/sig/declarations.rbs +10 -3
- data/sig/definition.rbs +80 -12
- data/sig/definition_builder.rbs +18 -4
- data/sig/directives.rbs +17 -1
- data/sig/environment.rbs +3 -1
- data/sig/errors.rbs +19 -0
- data/sig/namespace.rbs +2 -3
- data/sig/parser.rbs +5 -1
- data/sig/prototype/rb.rbs +1 -1
- data/sig/resolver/constant_resolver.rbs +2 -2
- data/sig/resolver/context.rbs +1 -1
- data/sig/subtractor.rbs +1 -1
- data/sig/test/type_check.rbs +2 -2
- data/sig/type_alias_dependency.rbs +2 -2
- data/sig/type_alias_regularity.rbs +6 -6
- data/sig/type_param.rbs +4 -4
- data/sig/typename.rbs +8 -5
- data/sig/types.rbs +1 -1
- data/sig/unit_test/spy.rbs +2 -0
- data/sig/unit_test/type_assertions.rbs +2 -0
- data/sig/use_map.rbs +1 -1
- data/sig/validator.rbs +6 -2
- data/sig/vendorer.rbs +1 -1
- data/sig/writer.rbs +1 -1
- data/{ext/rbs_extension → src}/constants.c +35 -36
- data/src/ruby_objs.c +799 -0
- data/src/util/rbs_constant_pool.c +342 -0
- data/stdlib/base64/0/base64.rbs +0 -9
- data/stdlib/benchmark/0/benchmark.rbs +11 -2
- data/stdlib/bigdecimal/0/big_decimal.rbs +26 -182
- data/stdlib/cgi/0/core.rbs +60 -3
- data/stdlib/cgi/0/manifest.yaml +1 -0
- data/stdlib/coverage/0/coverage.rbs +0 -3
- data/stdlib/csv/0/csv.rbs +18 -58
- data/stdlib/csv/0/manifest.yaml +1 -0
- data/stdlib/date/0/date.rbs +27 -42
- data/stdlib/did_you_mean/0/did_you_mean.rbs +1 -6
- data/stdlib/digest/0/digest.rbs +25 -2
- data/stdlib/erb/0/erb.rbs +0 -1
- data/stdlib/etc/0/etc.rbs +51 -34
- data/stdlib/fileutils/0/fileutils.rbs +3 -44
- data/stdlib/io-console/0/io-console.rbs +69 -15
- data/stdlib/ipaddr/0/ipaddr.rbs +16 -4
- data/stdlib/json/0/json.rbs +107 -120
- data/stdlib/logger/0/log_device.rbs +1 -1
- data/stdlib/logger/0/logger.rbs +3 -18
- data/stdlib/minitest/0/kernel.rbs +2 -2
- data/stdlib/minitest/0/minitest/abstract_reporter.rbs +4 -1
- data/stdlib/minitest/0/minitest/assertion.rbs +1 -0
- data/stdlib/minitest/0/minitest/assertions.rbs +58 -13
- data/stdlib/minitest/0/minitest/backtrace_filter.rbs +7 -0
- data/stdlib/minitest/0/minitest/bench_spec.rbs +8 -8
- data/stdlib/minitest/0/minitest/benchmark.rbs +17 -16
- data/stdlib/minitest/0/minitest/compress.rbs +13 -0
- data/stdlib/minitest/0/minitest/error_on_warning.rbs +3 -0
- data/stdlib/minitest/0/minitest/mock.rbs +9 -5
- data/stdlib/minitest/0/minitest/parallel/executor.rbs +4 -0
- data/stdlib/minitest/0/minitest/parallel/test/class_methods.rbs +0 -1
- data/stdlib/minitest/0/minitest/pride_io.rbs +8 -0
- data/stdlib/minitest/0/minitest/pride_lol.rbs +2 -0
- data/stdlib/minitest/0/minitest/progress_reporter.rbs +1 -1
- data/stdlib/minitest/0/minitest/reportable.rbs +2 -0
- data/stdlib/minitest/0/minitest/runnable.rbs +33 -1
- data/stdlib/minitest/0/minitest/spec/dsl/instance_methods.rbs +1 -1
- data/stdlib/minitest/0/minitest/spec/dsl.rbs +10 -6
- data/stdlib/minitest/0/minitest/spec.rbs +1 -1
- data/stdlib/minitest/0/minitest/statistics_reporter.rbs +5 -0
- data/stdlib/minitest/0/minitest/summary_reporter.rbs +0 -7
- data/stdlib/minitest/0/minitest/test/lifecycle_hooks.rbs +1 -1
- data/stdlib/minitest/0/minitest/test.rbs +7 -14
- data/stdlib/minitest/0/minitest/unexpected_error.rbs +2 -0
- data/stdlib/minitest/0/minitest/unexpected_warning.rbs +6 -0
- data/stdlib/minitest/0/minitest/unit.rbs +1 -2
- data/stdlib/minitest/0/minitest.rbs +41 -892
- data/stdlib/monitor/0/monitor.rbs +13 -4
- data/stdlib/net-http/0/net-http.rbs +42 -109
- data/stdlib/nkf/0/nkf.rbs +30 -0
- data/stdlib/objspace/0/objspace.rbs +1 -2
- data/stdlib/observable/0/observable.rbs +1 -1
- data/stdlib/open-uri/0/manifest.yaml +1 -0
- data/stdlib/open-uri/0/open-uri.rbs +52 -0
- data/stdlib/open3/0/open3.rbs +0 -8
- data/stdlib/openssl/0/manifest.yaml +1 -0
- data/stdlib/openssl/0/openssl.rbs +235 -143
- data/stdlib/optparse/0/optparse.rbs +58 -18
- data/stdlib/pathname/0/pathname.rbs +2 -8
- data/stdlib/pp/0/pp.rbs +3 -1
- data/stdlib/prettyprint/0/prettyprint.rbs +0 -4
- data/stdlib/pstore/0/pstore.rbs +0 -6
- data/stdlib/psych/0/core_ext.rbs +12 -0
- data/stdlib/psych/0/psych.rbs +15 -4
- data/stdlib/pty/0/pty.rbs +46 -4
- data/stdlib/rdoc/0/code_object.rbs +0 -4
- data/stdlib/rdoc/0/markup.rbs +10 -12
- data/stdlib/rdoc/0/rdoc.rbs +13 -8
- data/stdlib/resolv/0/resolv.rbs +21 -12
- data/stdlib/ripper/0/ripper.rbs +0 -2
- data/stdlib/securerandom/0/securerandom.rbs +7 -2
- data/stdlib/shellwords/0/shellwords.rbs +11 -12
- data/stdlib/singleton/0/singleton.rbs +0 -1
- data/stdlib/socket/0/addrinfo.rbs +1 -2
- data/stdlib/socket/0/basic_socket.rbs +0 -5
- data/stdlib/socket/0/socket.rbs +32 -27
- data/stdlib/socket/0/tcp_server.rbs +0 -3
- data/stdlib/socket/0/tcp_socket.rbs +36 -3
- data/stdlib/socket/0/udp_socket.rbs +0 -1
- data/stdlib/socket/0/unix_server.rbs +0 -3
- data/stdlib/socket/0/unix_socket.rbs +4 -2
- data/{core/string_io.rbs → stdlib/stringio/0/stringio.rbs} +1 -1
- data/stdlib/strscan/0/string_scanner.rbs +1265 -422
- data/stdlib/tempfile/0/tempfile.rbs +135 -28
- data/stdlib/time/0/time.rbs +48 -35
- data/stdlib/timeout/0/timeout.rbs +11 -8
- data/stdlib/tmpdir/0/tmpdir.rbs +10 -3
- data/stdlib/tsort/0/tsort.rbs +0 -4
- data/stdlib/uri/0/common.rbs +28 -30
- data/stdlib/uri/0/ftp.rbs +1 -1
- data/stdlib/uri/0/generic.rbs +22 -18
- data/stdlib/uri/0/http.rbs +2 -2
- data/stdlib/uri/0/rfc2396_parser.rbs +3 -0
- data/stdlib/zlib/0/buf_error.rbs +1 -70
- data/stdlib/zlib/0/data_error.rbs +1 -70
- data/stdlib/zlib/0/deflate.rbs +8 -72
- data/stdlib/zlib/0/error.rbs +1 -70
- data/stdlib/zlib/0/gzip_file/crc_error.rbs +2 -105
- data/stdlib/zlib/0/gzip_file/error.rbs +2 -105
- data/stdlib/zlib/0/gzip_file/length_error.rbs +2 -105
- data/stdlib/zlib/0/gzip_file/no_footer.rbs +2 -105
- data/stdlib/zlib/0/gzip_file.rbs +1 -71
- data/stdlib/zlib/0/gzip_reader.rbs +3 -74
- data/stdlib/zlib/0/gzip_writer.rbs +1 -70
- data/stdlib/zlib/0/inflate.rbs +4 -71
- data/stdlib/zlib/0/mem_error.rbs +1 -70
- data/stdlib/zlib/0/need_dict.rbs +1 -70
- data/stdlib/zlib/0/stream_end.rbs +1 -70
- data/stdlib/zlib/0/stream_error.rbs +1 -70
- data/stdlib/zlib/0/version_error.rbs +1 -70
- data/stdlib/zlib/0/zlib.rbs +0 -2
- data/stdlib/zlib/0/zstream.rbs +4 -72
- metadata +17 -13
- data/ext/rbs_extension/ruby_objs.c +0 -602
- data/ext/rbs_extension/ruby_objs.h +0 -51
- data/stdlib/minitest/0/manifest.yaml +0 -2
@@ -1,155 +1,3 @@
|
|
1
|
-
# <!-- rdoc-file=ext/bigdecimal/bigdecimal.c -->
|
2
|
-
# BigDecimal provides arbitrary-precision floating point decimal arithmetic.
|
3
|
-
#
|
4
|
-
# ## Introduction
|
5
|
-
#
|
6
|
-
# Ruby provides built-in support for arbitrary precision integer arithmetic.
|
7
|
-
#
|
8
|
-
# For example:
|
9
|
-
#
|
10
|
-
# 42**13 #=> 1265437718438866624512
|
11
|
-
#
|
12
|
-
# BigDecimal provides similar support for very large or very accurate floating
|
13
|
-
# point numbers.
|
14
|
-
#
|
15
|
-
# Decimal arithmetic is also useful for general calculation, because it provides
|
16
|
-
# the correct answers people expect--whereas normal binary floating point
|
17
|
-
# arithmetic often introduces subtle errors because of the conversion between
|
18
|
-
# base 10 and base 2.
|
19
|
-
#
|
20
|
-
# For example, try:
|
21
|
-
#
|
22
|
-
# sum = 0
|
23
|
-
# 10_000.times do
|
24
|
-
# sum = sum + 0.0001
|
25
|
-
# end
|
26
|
-
# print sum #=> 0.9999999999999062
|
27
|
-
#
|
28
|
-
# and contrast with the output from:
|
29
|
-
#
|
30
|
-
# require 'bigdecimal'
|
31
|
-
#
|
32
|
-
# sum = BigDecimal("0")
|
33
|
-
# 10_000.times do
|
34
|
-
# sum = sum + BigDecimal("0.0001")
|
35
|
-
# end
|
36
|
-
# print sum #=> 0.1E1
|
37
|
-
#
|
38
|
-
# Similarly:
|
39
|
-
#
|
40
|
-
# (BigDecimal("1.2") - BigDecimal("1.0")) == BigDecimal("0.2") #=> true
|
41
|
-
#
|
42
|
-
# (1.2 - 1.0) == 0.2 #=> false
|
43
|
-
#
|
44
|
-
# ## A Note About Precision
|
45
|
-
#
|
46
|
-
# For a calculation using a BigDecimal and another `value`, the precision of the
|
47
|
-
# result depends on the type of `value`:
|
48
|
-
#
|
49
|
-
# * If `value` is a Float, the precision is Float::DIG + 1.
|
50
|
-
# * If `value` is a Rational, the precision is larger than Float::DIG + 1.
|
51
|
-
# * If `value` is a BigDecimal, the precision is `value`'s precision in the
|
52
|
-
# internal representation, which is platform-dependent.
|
53
|
-
# * If `value` is other object, the precision is determined by the result of
|
54
|
-
# +BigDecimal(value)+.
|
55
|
-
#
|
56
|
-
#
|
57
|
-
# ## Special features of accurate decimal arithmetic
|
58
|
-
#
|
59
|
-
# Because BigDecimal is more accurate than normal binary floating point
|
60
|
-
# arithmetic, it requires some special values.
|
61
|
-
#
|
62
|
-
# ### Infinity
|
63
|
-
#
|
64
|
-
# BigDecimal sometimes needs to return infinity, for example if you divide a
|
65
|
-
# value by zero.
|
66
|
-
#
|
67
|
-
# BigDecimal("1.0") / BigDecimal("0.0") #=> Infinity
|
68
|
-
# BigDecimal("-1.0") / BigDecimal("0.0") #=> -Infinity
|
69
|
-
#
|
70
|
-
# You can represent infinite numbers to BigDecimal using the strings
|
71
|
-
# `'Infinity'`, `'+Infinity'` and `'-Infinity'` (case-sensitive)
|
72
|
-
#
|
73
|
-
# ### Not a Number
|
74
|
-
#
|
75
|
-
# When a computation results in an undefined value, the special value `NaN` (for
|
76
|
-
# 'not a number') is returned.
|
77
|
-
#
|
78
|
-
# Example:
|
79
|
-
#
|
80
|
-
# BigDecimal("0.0") / BigDecimal("0.0") #=> NaN
|
81
|
-
#
|
82
|
-
# You can also create undefined values.
|
83
|
-
#
|
84
|
-
# NaN is never considered to be the same as any other value, even NaN itself:
|
85
|
-
#
|
86
|
-
# n = BigDecimal('NaN')
|
87
|
-
# n == 0.0 #=> false
|
88
|
-
# n == n #=> false
|
89
|
-
#
|
90
|
-
# ### Positive and negative zero
|
91
|
-
#
|
92
|
-
# If a computation results in a value which is too small to be represented as a
|
93
|
-
# BigDecimal within the currently specified limits of precision, zero must be
|
94
|
-
# returned.
|
95
|
-
#
|
96
|
-
# If the value which is too small to be represented is negative, a BigDecimal
|
97
|
-
# value of negative zero is returned.
|
98
|
-
#
|
99
|
-
# BigDecimal("1.0") / BigDecimal("-Infinity") #=> -0.0
|
100
|
-
#
|
101
|
-
# If the value is positive, a value of positive zero is returned.
|
102
|
-
#
|
103
|
-
# BigDecimal("1.0") / BigDecimal("Infinity") #=> 0.0
|
104
|
-
#
|
105
|
-
# (See BigDecimal.mode for how to specify limits of precision.)
|
106
|
-
#
|
107
|
-
# Note that `-0.0` and `0.0` are considered to be the same for the purposes of
|
108
|
-
# comparison.
|
109
|
-
#
|
110
|
-
# Note also that in mathematics, there is no particular concept of negative or
|
111
|
-
# positive zero; true mathematical zero has no sign.
|
112
|
-
#
|
113
|
-
# ## bigdecimal/util
|
114
|
-
#
|
115
|
-
# When you require `bigdecimal/util`, the #to_d method will be available on
|
116
|
-
# BigDecimal and the native Integer, Float, Rational, and String classes:
|
117
|
-
#
|
118
|
-
# require 'bigdecimal/util'
|
119
|
-
#
|
120
|
-
# 42.to_d # => 0.42e2
|
121
|
-
# 0.5.to_d # => 0.5e0
|
122
|
-
# (2/3r).to_d(3) # => 0.667e0
|
123
|
-
# "0.5".to_d # => 0.5e0
|
124
|
-
#
|
125
|
-
# ## Methods for Working with JSON
|
126
|
-
#
|
127
|
-
# * [::json_create](rdoc-ref:BigDecimal.json_create): Returns a new BigDecimal
|
128
|
-
# object constructed from the given object.
|
129
|
-
# * [#as_json](rdoc-ref:BigDecimal#as_json): Returns a 2-element hash
|
130
|
-
# representing `self`.
|
131
|
-
# * [#to_json](rdoc-ref:BigDecimal#to_json): Returns a JSON string
|
132
|
-
# representing `self`.
|
133
|
-
#
|
134
|
-
#
|
135
|
-
# These methods are provided by the [JSON gem](https://github.com/flori/json).
|
136
|
-
# To make these methods available:
|
137
|
-
#
|
138
|
-
# require 'json/add/bigdecimal'
|
139
|
-
#
|
140
|
-
# * ## License
|
141
|
-
#
|
142
|
-
#
|
143
|
-
# Copyright (C) 2002 by Shigeo Kobayashi <shigeo@tinyforest.gr.jp>.
|
144
|
-
#
|
145
|
-
# BigDecimal is released under the Ruby and 2-clause BSD licenses. See
|
146
|
-
# LICENSE.txt for details.
|
147
|
-
#
|
148
|
-
# Maintained by mrkn <mrkn@mrkn.jp> and ruby-core members.
|
149
|
-
#
|
150
|
-
# Documented by zzak <zachary@zacharyscott.net>, mathew <meta@pobox.com>, and
|
151
|
-
# many other contributors.
|
152
|
-
#
|
153
1
|
class BigDecimal < Numeric
|
154
2
|
# <!--
|
155
3
|
# rdoc-file=ext/bigdecimal/bigdecimal.c
|
@@ -208,14 +56,12 @@ class BigDecimal < Numeric
|
|
208
56
|
# * BigDecimal::EXCEPTION_ZERODIVIDE.
|
209
57
|
# * BigDecimal::EXCEPTION_ALL.
|
210
58
|
#
|
211
|
-
#
|
212
59
|
# Values for `setting` for exception handling:
|
213
60
|
#
|
214
61
|
# * `true`: sets the given `mode` to `true`.
|
215
62
|
# * `false`: sets the given `mode` to `false`.
|
216
63
|
# * `nil`: does not modify the mode settings.
|
217
64
|
#
|
218
|
-
#
|
219
65
|
# You can use method BigDecimal.save_exception_mode to temporarily change, and
|
220
66
|
# then automatically restore, exception modes.
|
221
67
|
#
|
@@ -226,7 +72,6 @@ class BigDecimal < Numeric
|
|
226
72
|
#
|
227
73
|
# * BigDecimal::ROUND_MODE
|
228
74
|
#
|
229
|
-
#
|
230
75
|
# You can use method BigDecimal.save_rounding_mode to temporarily change, and
|
231
76
|
# then automatically restore, the rounding mode.
|
232
77
|
#
|
@@ -240,7 +85,6 @@ class BigDecimal < Numeric
|
|
240
85
|
# * `false` (default): Returns `BigDecimal('NaN')`.
|
241
86
|
# * `true`: Raises FloatDomainError.
|
242
87
|
#
|
243
|
-
#
|
244
88
|
# Examples:
|
245
89
|
#
|
246
90
|
# BigDecimal.mode(BigDecimal::EXCEPTION_ALL, false) # => 0
|
@@ -257,7 +101,6 @@ class BigDecimal < Numeric
|
|
257
101
|
# `BigDecimal('-Infinity')`.
|
258
102
|
# * `true`: Raises FloatDomainError.
|
259
103
|
#
|
260
|
-
#
|
261
104
|
# Examples:
|
262
105
|
#
|
263
106
|
# BigDecimal.mode(BigDecimal::EXCEPTION_ALL, false) # => 0
|
@@ -275,7 +118,6 @@ class BigDecimal < Numeric
|
|
275
118
|
# * `false` (default): Returns `BigDecimal('0')` or `BigDecimal('-Infinity')`.
|
276
119
|
# * `true`: Raises FloatDomainError.
|
277
120
|
#
|
278
|
-
#
|
279
121
|
# Examples:
|
280
122
|
#
|
281
123
|
# BigDecimal.mode(BigDecimal::EXCEPTION_ALL, false) # => 0
|
@@ -296,7 +138,6 @@ class BigDecimal < Numeric
|
|
296
138
|
# `BigDecimal('-Infinity')`.
|
297
139
|
# * `true`: Raises FloatDomainError.
|
298
140
|
#
|
299
|
-
#
|
300
141
|
# Examples:
|
301
142
|
#
|
302
143
|
# BigDecimal.mode(BigDecimal::EXCEPTION_ALL, false) # => 0
|
@@ -317,7 +158,6 @@ class BigDecimal < Numeric
|
|
317
158
|
# `BigDecimal('-Infinity')`.
|
318
159
|
# * `true`: Raises FloatDomainError.
|
319
160
|
#
|
320
|
-
#
|
321
161
|
# Examples:
|
322
162
|
#
|
323
163
|
# BigDecimal.mode(BigDecimal::EXCEPTION_ALL, false) # => 0
|
@@ -1030,16 +870,22 @@ class BigDecimal < Numeric
|
|
1030
870
|
#
|
1031
871
|
# BigDecimal::SIGN_NaN
|
1032
872
|
# : value is Not a Number
|
873
|
+
#
|
1033
874
|
# BigDecimal::SIGN_POSITIVE_ZERO
|
1034
875
|
# : value is +0
|
876
|
+
#
|
1035
877
|
# BigDecimal::SIGN_NEGATIVE_ZERO
|
1036
878
|
# : value is -0
|
879
|
+
#
|
1037
880
|
# BigDecimal::SIGN_POSITIVE_INFINITE
|
1038
881
|
# : value is +Infinity
|
882
|
+
#
|
1039
883
|
# BigDecimal::SIGN_NEGATIVE_INFINITE
|
1040
884
|
# : value is -Infinity
|
885
|
+
#
|
1041
886
|
# BigDecimal::SIGN_POSITIVE_FINITE
|
1042
887
|
# : value is positive
|
888
|
+
#
|
1043
889
|
# BigDecimal::SIGN_NEGATIVE_FINITE
|
1044
890
|
# : value is negative
|
1045
891
|
#
|
@@ -1403,8 +1249,6 @@ module Kernel
|
|
1403
1249
|
# * Raises an exception if keyword argument `exception` is `true`.
|
1404
1250
|
# * Returns `nil` if keyword argument `exception` is `false`.
|
1405
1251
|
#
|
1406
|
-
#
|
1407
|
-
#
|
1408
1252
|
# Raises an exception if `value` evaluates to a Float and `digits` is larger
|
1409
1253
|
# than Float::DIG + 1.
|
1410
1254
|
#
|
@@ -1713,11 +1557,11 @@ class Complex
|
|
1713
1557
|
# -->
|
1714
1558
|
# Returns the quotient of `self` and `numeric`:
|
1715
1559
|
#
|
1716
|
-
# Complex(2, 3) / Complex(2, 3) # => (
|
1717
|
-
# Complex(900) / Complex(1) # => (
|
1718
|
-
# Complex(-2, 9) / Complex(-9, 2) # => ((36/85)-(77/85)*i)
|
1719
|
-
# Complex(9, 8) / 4
|
1720
|
-
# Complex(20, 9) / 9.8
|
1560
|
+
# Complex.rect(2, 3) / Complex.rect(2, 3) # => (1+0i)
|
1561
|
+
# Complex.rect(900) / Complex.rect(1) # => (900+0i)
|
1562
|
+
# Complex.rect(-2, 9) / Complex.rect(-9, 2) # => ((36/85)-(77/85)*i)
|
1563
|
+
# Complex.rect(9, 8) / 4 # => ((9/4)+2i)
|
1564
|
+
# Complex.rect(20, 9) / 9.8 # => (2.0408163265306123+0.9183673469387754i)
|
1721
1565
|
#
|
1722
1566
|
def /: (BigDecimal) -> Complex
|
1723
1567
|
| ...
|
@@ -1728,11 +1572,11 @@ class Complex
|
|
1728
1572
|
# -->
|
1729
1573
|
# Returns the product of `self` and `numeric`:
|
1730
1574
|
#
|
1731
|
-
# Complex(2, 3) * Complex(2, 3) # => (-5+12i)
|
1732
|
-
# Complex(900) * Complex(1) # => (900+0i)
|
1733
|
-
# Complex(-2, 9) * Complex(-9, 2) # => (0-85i)
|
1734
|
-
# Complex(9, 8) * 4
|
1735
|
-
# Complex(20, 9) * 9.8
|
1575
|
+
# Complex.rect(2, 3) * Complex.rect(2, 3) # => (-5+12i)
|
1576
|
+
# Complex.rect(900) * Complex.rect(1) # => (900+0i)
|
1577
|
+
# Complex.rect(-2, 9) * Complex.rect(-9, 2) # => (0-85i)
|
1578
|
+
# Complex.rect(9, 8) * 4 # => (36+32i)
|
1579
|
+
# Complex.rect(20, 9) * 9.8 # => (196.0+88.2i)
|
1736
1580
|
#
|
1737
1581
|
def *: (BigDecimal) -> Complex
|
1738
1582
|
| ...
|
@@ -1743,11 +1587,11 @@ class Complex
|
|
1743
1587
|
# -->
|
1744
1588
|
# Returns the sum of `self` and `numeric`:
|
1745
1589
|
#
|
1746
|
-
# Complex(2, 3) + Complex(2, 3) # => (4+6i)
|
1747
|
-
# Complex(900) + Complex(1) # => (901+0i)
|
1748
|
-
# Complex(-2, 9) + Complex(-9, 2) # => (-11+11i)
|
1749
|
-
# Complex(9, 8) + 4
|
1750
|
-
# Complex(20, 9) + 9.8
|
1590
|
+
# Complex.rect(2, 3) + Complex.rect(2, 3) # => (4+6i)
|
1591
|
+
# Complex.rect(900) + Complex.rect(1) # => (901+0i)
|
1592
|
+
# Complex.rect(-2, 9) + Complex.rect(-9, 2) # => (-11+11i)
|
1593
|
+
# Complex.rect(9, 8) + 4 # => (13+8i)
|
1594
|
+
# Complex.rect(20, 9) + 9.8 # => (29.8+9i)
|
1751
1595
|
#
|
1752
1596
|
def +: (BigDecimal) -> Complex
|
1753
1597
|
| ...
|
@@ -1758,11 +1602,11 @@ class Complex
|
|
1758
1602
|
# -->
|
1759
1603
|
# Returns the difference of `self` and `numeric`:
|
1760
1604
|
#
|
1761
|
-
# Complex(2, 3) - Complex(2, 3) # => (0+0i)
|
1762
|
-
# Complex(900) - Complex(1) # => (899+0i)
|
1763
|
-
# Complex(-2, 9) - Complex(-9, 2) # => (7+7i)
|
1764
|
-
# Complex(9, 8) - 4
|
1765
|
-
# Complex(20, 9) - 9.8
|
1605
|
+
# Complex.rect(2, 3) - Complex.rect(2, 3) # => (0+0i)
|
1606
|
+
# Complex.rect(900) - Complex.rect(1) # => (899+0i)
|
1607
|
+
# Complex.rect(-2, 9) - Complex.rect(-9, 2) # => (7+7i)
|
1608
|
+
# Complex.rect(9, 8) - 4 # => (5+8i)
|
1609
|
+
# Complex.rect(20, 9) - 9.8 # => (10.2+9i)
|
1766
1610
|
#
|
1767
1611
|
def -: (BigDecimal) -> Complex
|
1768
1612
|
| ...
|
data/stdlib/cgi/0/core.rbs
CHANGED
@@ -91,8 +91,10 @@
|
|
91
91
|
#
|
92
92
|
# #local_path()
|
93
93
|
# : the path of the uploaded file on the local filesystem
|
94
|
+
#
|
94
95
|
# #original_filename()
|
95
96
|
# : the name of the file on the client computer
|
97
|
+
#
|
96
98
|
# #content_type()
|
97
99
|
# : the content type of the file
|
98
100
|
#
|
@@ -285,6 +287,7 @@ class CGI
|
|
285
287
|
# :tag_maker => tag_maker }` Note that it is recommended to use the
|
286
288
|
# `options_hash` form, since it also allows you specify the charset you will
|
287
289
|
# accept.
|
290
|
+
#
|
288
291
|
# `options_hash`
|
289
292
|
# : A Hash that recognizes three options:
|
290
293
|
#
|
@@ -303,6 +306,7 @@ class CGI
|
|
303
306
|
#
|
304
307
|
# cgi=CGI.new(:accept_charset => "EUC-JP") # => "EUC-JP"
|
305
308
|
#
|
309
|
+
#
|
306
310
|
# `:tag_maker`
|
307
311
|
# : String that specifies which version of the HTML generation methods to
|
308
312
|
# use. If not specified, no HTML generation methods will be loaded.
|
@@ -311,16 +315,21 @@ class CGI
|
|
311
315
|
#
|
312
316
|
# "html3"
|
313
317
|
# : HTML 3.x
|
318
|
+
#
|
314
319
|
# "html4"
|
315
320
|
# : HTML 4.0
|
321
|
+
#
|
316
322
|
# "html4Tr"
|
317
323
|
# : HTML 4.0 Transitional
|
324
|
+
#
|
318
325
|
# "html4Fr"
|
319
326
|
# : HTML 4.0 with Framesets
|
327
|
+
#
|
320
328
|
# "html5"
|
321
329
|
# : HTML 5
|
322
330
|
#
|
323
331
|
#
|
332
|
+
#
|
324
333
|
# `:max_multipart_length`
|
325
334
|
# : Specifies maximum length of multipart data. Can be an Integer scalar
|
326
335
|
# or a lambda, that will be evaluated when the request is parsed. This
|
@@ -334,6 +343,7 @@ class CGI
|
|
334
343
|
# cgi=CGI.new(:max_multipart_length => -> {check_filesystem}) # lambda
|
335
344
|
#
|
336
345
|
#
|
346
|
+
#
|
337
347
|
# `block`
|
338
348
|
# : If provided, the block is called when an invalid encoding is encountered.
|
339
349
|
# For example:
|
@@ -360,7 +370,7 @@ class CGI
|
|
360
370
|
# -->
|
361
371
|
# Return the accept character set for all new CGI instances.
|
362
372
|
#
|
363
|
-
def self.accept_charset: () ->
|
373
|
+
def self.accept_charset: () -> encoding
|
364
374
|
|
365
375
|
# <!--
|
366
376
|
# rdoc-file=lib/cgi/core.rb
|
@@ -368,7 +378,7 @@ class CGI
|
|
368
378
|
# -->
|
369
379
|
# Set the accept character set for all new CGI instances.
|
370
380
|
#
|
371
|
-
def self.accept_charset=: (
|
381
|
+
def self.accept_charset=: (encoding accept_charset) -> encoding
|
372
382
|
|
373
383
|
# <!--
|
374
384
|
# rdoc-file=lib/cgi/core.rb
|
@@ -385,7 +395,7 @@ class CGI
|
|
385
395
|
# <!-- rdoc-file=lib/cgi/core.rb -->
|
386
396
|
# Return the accept character set for this CGI instance.
|
387
397
|
#
|
388
|
-
attr_reader accept_charset:
|
398
|
+
attr_reader accept_charset: encoding
|
389
399
|
|
390
400
|
# <!-- rdoc-file=lib/cgi/core.rb -->
|
391
401
|
# This method is an alias for #http_header, when HTML5 tag maker is inactive.
|
@@ -408,72 +418,99 @@ class CGI
|
|
408
418
|
#
|
409
419
|
# `content_type_string`
|
410
420
|
# : If this form is used, this string is the `Content-Type`
|
421
|
+
#
|
411
422
|
# `headers_hash`
|
412
423
|
# : A Hash of header values. The following header keys are recognized:
|
413
424
|
#
|
414
425
|
# type
|
415
426
|
# : The Content-Type header. Defaults to "text/html"
|
427
|
+
#
|
416
428
|
# charset
|
417
429
|
# : The charset of the body, appended to the Content-Type header.
|
430
|
+
#
|
418
431
|
# nph
|
419
432
|
# : A boolean value. If true, prepend protocol string and status code,
|
420
433
|
# and date; and sets default values for "server" and "connection" if not
|
421
434
|
# explicitly set.
|
435
|
+
#
|
422
436
|
# status
|
423
437
|
# : The HTTP status code as a String, returned as the Status header. The
|
424
438
|
# values are:
|
425
439
|
#
|
426
440
|
# OK
|
427
441
|
# : 200 OK
|
442
|
+
#
|
428
443
|
# PARTIAL_CONTENT
|
429
444
|
# : 206 Partial Content
|
445
|
+
#
|
430
446
|
# MULTIPLE_CHOICES
|
431
447
|
# : 300 Multiple Choices
|
448
|
+
#
|
432
449
|
# MOVED
|
433
450
|
# : 301 Moved Permanently
|
451
|
+
#
|
434
452
|
# REDIRECT
|
435
453
|
# : 302 Found
|
454
|
+
#
|
436
455
|
# NOT_MODIFIED
|
437
456
|
# : 304 Not Modified
|
457
|
+
#
|
438
458
|
# BAD_REQUEST
|
439
459
|
# : 400 Bad Request
|
460
|
+
#
|
440
461
|
# AUTH_REQUIRED
|
441
462
|
# : 401 Authorization Required
|
463
|
+
#
|
442
464
|
# FORBIDDEN
|
443
465
|
# : 403 Forbidden
|
466
|
+
#
|
444
467
|
# NOT_FOUND
|
445
468
|
# : 404 Not Found
|
469
|
+
#
|
446
470
|
# METHOD_NOT_ALLOWED
|
447
471
|
# : 405 Method Not Allowed
|
472
|
+
#
|
448
473
|
# NOT_ACCEPTABLE
|
449
474
|
# : 406 Not Acceptable
|
475
|
+
#
|
450
476
|
# LENGTH_REQUIRED
|
451
477
|
# : 411 Length Required
|
478
|
+
#
|
452
479
|
# PRECONDITION_FAILED
|
453
480
|
# : 412 Precondition Failed
|
481
|
+
#
|
454
482
|
# SERVER_ERROR
|
455
483
|
# : 500 Internal Server Error
|
484
|
+
#
|
456
485
|
# NOT_IMPLEMENTED
|
457
486
|
# : 501 Method Not Implemented
|
487
|
+
#
|
458
488
|
# BAD_GATEWAY
|
459
489
|
# : 502 Bad Gateway
|
490
|
+
#
|
460
491
|
# VARIANT_ALSO_VARIES
|
461
492
|
# : 506 Variant Also Negotiates
|
462
493
|
#
|
463
494
|
#
|
495
|
+
#
|
464
496
|
# server
|
465
497
|
# : The server software, returned as the Server header.
|
498
|
+
#
|
466
499
|
# connection
|
467
500
|
# : The connection type, returned as the Connection header (for instance,
|
468
501
|
# "close".
|
502
|
+
#
|
469
503
|
# length
|
470
504
|
# : The length of the content that will be sent, returned as the
|
471
505
|
# Content-Length header.
|
506
|
+
#
|
472
507
|
# language
|
473
508
|
# : The language of the content, returned as the Content-Language header.
|
509
|
+
#
|
474
510
|
# expires
|
475
511
|
# : The time on which the current content expires, as a `Time` object,
|
476
512
|
# returned as the Expires header.
|
513
|
+
#
|
477
514
|
# cookie
|
478
515
|
# : A cookie or cookies, returned as one or more Set-Cookie headers. The
|
479
516
|
# value can be the literal string of the cookie; a CGI::Cookie object;
|
@@ -526,8 +563,10 @@ class CGI
|
|
526
563
|
#
|
527
564
|
# `content_type_string`
|
528
565
|
# : If a string is passed, it is assumed to be the content type.
|
566
|
+
#
|
529
567
|
# `headers_hash`
|
530
568
|
# : This is a Hash of headers, similar to that used by #http_header.
|
569
|
+
#
|
531
570
|
# `block`
|
532
571
|
# : A block is required and should evaluate to the body of the response.
|
533
572
|
#
|
@@ -829,25 +868,33 @@ class CGI
|
|
829
868
|
# : The name of the cookie; in this form, there is no #domain or #expiration.
|
830
869
|
# The #path is gleaned from the `SCRIPT_NAME` environment variable, and
|
831
870
|
# #secure is false.
|
871
|
+
#
|
832
872
|
# `*value`
|
833
873
|
# : value or list of values of the cookie
|
874
|
+
#
|
834
875
|
# `options_hash`
|
835
876
|
# : A Hash of options to initialize this Cookie. Possible options are:
|
836
877
|
#
|
837
878
|
# name
|
838
879
|
# : the name of the cookie. Required.
|
880
|
+
#
|
839
881
|
# value
|
840
882
|
# : the cookie's value or list of values.
|
883
|
+
#
|
841
884
|
# path
|
842
885
|
# : the path for which this cookie applies. Defaults to the value of the
|
843
886
|
# `SCRIPT_NAME` environment variable.
|
887
|
+
#
|
844
888
|
# domain
|
845
889
|
# : the domain for which this cookie applies.
|
890
|
+
#
|
846
891
|
# expires
|
847
892
|
# : the time at which this cookie expires, as a `Time` object.
|
893
|
+
#
|
848
894
|
# secure
|
849
895
|
# : whether this cookie is a secure cookie or not (default to false).
|
850
896
|
# Secure cookies are only transmitted to HTTPS servers.
|
897
|
+
#
|
851
898
|
# httponly
|
852
899
|
# : whether this cookie is a HttpOnly cookie or not (default to
|
853
900
|
#
|
@@ -884,6 +931,11 @@ class CGI
|
|
884
931
|
#
|
885
932
|
def escapeURIComponent: (string) -> String
|
886
933
|
|
934
|
+
# <!-- rdoc-file=ext/cgi/escape/escape.c -->
|
935
|
+
# Returns URL-escaped string following RFC 3986.
|
936
|
+
#
|
937
|
+
alias escape_uri_component escapeURIComponent
|
938
|
+
|
887
939
|
# <!--
|
888
940
|
# rdoc-file=ext/cgi/escape/escape.c
|
889
941
|
# - CGI.unescape(string, encoding=@@accept_charset) -> string
|
@@ -907,6 +959,11 @@ class CGI
|
|
907
959
|
# Returns URL-unescaped string following RFC 3986.
|
908
960
|
#
|
909
961
|
def unescapeURIComponent: (string) -> String
|
962
|
+
|
963
|
+
# <!-- rdoc-file=ext/cgi/escape/escape.c -->
|
964
|
+
# Returns URL-unescaped string following RFC 3986.
|
965
|
+
#
|
966
|
+
alias unescape_uri_component unescapeURIComponent
|
910
967
|
end
|
911
968
|
|
912
969
|
# <!-- rdoc-file=lib/cgi/core.rb -->
|
data/stdlib/cgi/0/manifest.yaml
CHANGED
@@ -15,7 +15,6 @@
|
|
15
15
|
# of line execution by the interpreter. A `nil` value means coverage is
|
16
16
|
# disabled for this line (lines like `else` and `end`).
|
17
17
|
#
|
18
|
-
#
|
19
18
|
# # Examples
|
20
19
|
#
|
21
20
|
# [foo.rb]
|
@@ -95,7 +94,6 @@
|
|
95
94
|
# 5. The ending line number it appears on in the file.
|
96
95
|
# 6. The ending column number it appears on in the file.
|
97
96
|
#
|
98
|
-
#
|
99
97
|
# ## Methods Coverage
|
100
98
|
#
|
101
99
|
# Methods coverage reports how many times each method was executed.
|
@@ -134,7 +132,6 @@
|
|
134
132
|
# 5. The ending line number the method appears on in the file.
|
135
133
|
# 6. The ending column number the method appears on in the file.
|
136
134
|
#
|
137
|
-
#
|
138
135
|
# ## All Coverage Modes
|
139
136
|
#
|
140
137
|
# You can also run all modes of coverage simultaneously with this shortcut. Note
|