rbs 3.0.0.dev.2 → 3.0.0.dev.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/comments.yml +2 -1
- data/.github/workflows/ruby.yml +4 -0
- data/Gemfile.lock +11 -11
- data/Rakefile +2 -2
- data/Steepfile +1 -1
- data/core/array.rbs +573 -423
- data/core/basic_object.rbs +11 -39
- data/core/binding.rbs +1 -1
- data/core/builtin.rbs +8 -0
- data/core/class.rbs +37 -0
- data/core/comparable.rbs +7 -18
- data/core/complex.rbs +2 -2
- data/core/data.rbs +419 -0
- data/core/dir.rbs +52 -104
- data/core/encoding.rbs +22 -181
- data/core/enumerable.rbs +212 -175
- data/core/enumerator/product.rbs +96 -0
- data/core/enumerator.rbs +57 -8
- data/core/errors.rbs +8 -2
- data/core/exception.rbs +41 -0
- data/core/fiber.rbs +95 -12
- data/core/file.rbs +840 -275
- data/core/file_test.rbs +34 -19
- data/core/float.rbs +40 -96
- data/core/gc.rbs +15 -3
- data/core/hash.rbs +113 -175
- data/core/integer.rbs +85 -145
- data/core/io/buffer.rbs +187 -60
- data/core/io/wait.rbs +28 -16
- data/core/io.rbs +1859 -1389
- data/core/kernel.rbs +525 -961
- data/core/match_data.rbs +306 -142
- data/core/math.rbs +506 -234
- data/core/method.rbs +0 -24
- data/core/module.rbs +110 -17
- data/core/nil_class.rbs +2 -0
- data/core/numeric.rbs +76 -144
- data/core/object.rbs +88 -212
- data/core/proc.rbs +17 -5
- data/core/process.rbs +22 -5
- data/core/ractor.rbs +1 -1
- data/core/random.rbs +20 -3
- data/core/range.rbs +91 -89
- data/core/rational.rbs +2 -3
- data/core/rbs/unnamed/argf.rbs +177 -120
- data/core/rbs/unnamed/env_class.rbs +89 -163
- data/core/rbs/unnamed/random.rbs +36 -12
- data/core/refinement.rbs +8 -0
- data/core/regexp.rbs +462 -272
- data/core/ruby_vm.rbs +210 -0
- data/{stdlib/set/0 → core}/set.rbs +43 -47
- data/core/string.rbs +1403 -1332
- data/core/string_io.rbs +191 -107
- data/core/struct.rbs +67 -63
- data/core/symbol.rbs +187 -201
- data/core/thread.rbs +40 -35
- data/core/time.rbs +902 -826
- data/core/trace_point.rbs +55 -6
- data/core/unbound_method.rbs +48 -24
- data/docs/collection.md +4 -0
- data/docs/syntax.md +55 -0
- data/ext/rbs_extension/parser.c +5 -6
- data/lib/rbs/cli.rb +6 -1
- data/lib/rbs/collection/cleaner.rb +8 -1
- data/lib/rbs/collection/config/lockfile.rb +3 -1
- data/lib/rbs/collection/config/lockfile_generator.rb +16 -14
- data/lib/rbs/collection/config.rb +1 -1
- data/lib/rbs/collection/sources/git.rb +9 -2
- data/lib/rbs/collection/sources/local.rb +79 -0
- data/lib/rbs/collection/sources.rb +8 -1
- data/lib/rbs/environment.rb +6 -5
- data/lib/rbs/environment_loader.rb +3 -2
- data/lib/rbs/errors.rb +18 -0
- data/lib/rbs/locator.rb +26 -7
- data/lib/rbs/sorter.rb +2 -2
- data/lib/rbs/version.rb +1 -1
- data/sig/collection/sources.rbs +32 -3
- data/sig/environment.rbs +2 -3
- data/sig/locator.rbs +14 -2
- data/sig/shims/{abstract_syntax_tree.rbs → _abstract_syntax_tree.rbs} +0 -0
- data/stdlib/bigdecimal/0/big_decimal.rbs +16 -13
- data/stdlib/cgi/0/core.rbs +16 -0
- data/stdlib/coverage/0/coverage.rbs +50 -8
- data/stdlib/csv/0/csv.rbs +1 -1
- data/stdlib/date/0/date.rbs +856 -726
- data/stdlib/date/0/date_time.rbs +83 -210
- data/stdlib/erb/0/erb.rbs +13 -36
- data/stdlib/etc/0/etc.rbs +127 -20
- data/stdlib/fileutils/0/fileutils.rbs +1290 -381
- data/stdlib/logger/0/logger.rbs +466 -316
- data/stdlib/net-http/0/net-http.rbs +2211 -534
- data/stdlib/nkf/0/nkf.rbs +5 -5
- data/stdlib/objspace/0/objspace.rbs +31 -14
- data/stdlib/openssl/0/openssl.rbs +11 -7
- data/stdlib/optparse/0/optparse.rbs +20 -17
- data/stdlib/pathname/0/pathname.rbs +21 -4
- data/stdlib/pstore/0/pstore.rbs +378 -154
- data/stdlib/pty/0/pty.rbs +24 -8
- data/stdlib/ripper/0/ripper.rbs +1650 -0
- data/stdlib/socket/0/addrinfo.rbs +9 -15
- data/stdlib/socket/0/socket.rbs +36 -3
- data/stdlib/strscan/0/string_scanner.rbs +7 -5
- data/stdlib/tempfile/0/tempfile.rbs +104 -44
- data/stdlib/time/0/time.rbs +2 -2
- data/stdlib/uri/0/file.rbs +5 -0
- data/stdlib/uri/0/generic.rbs +2 -2
- data/stdlib/yaml/0/yaml.rbs +2 -2
- data/stdlib/zlib/0/zlib.rbs +1 -1
- metadata +8 -6
- data/core/deprecated.rbs +0 -9
- data/sig/shims/ripper.rbs +0 -8
data/core/integer.rbs
CHANGED
@@ -3,13 +3,12 @@
|
|
3
3
|
#
|
4
4
|
# You can create an Integer object explicitly with:
|
5
5
|
#
|
6
|
-
# * An [integer
|
7
|
-
# literal](doc/syntax/literals_rdoc.html#label-Integer+Literals).
|
6
|
+
# * An [integer literal](rdoc-ref:syntax/literals.rdoc@Integer+Literals).
|
8
7
|
#
|
9
8
|
#
|
10
9
|
# You can convert certain objects to Integers with:
|
11
10
|
#
|
12
|
-
# * Method
|
11
|
+
# * Method #Integer.
|
13
12
|
#
|
14
13
|
#
|
15
14
|
# An attempt to add a singleton method to an instance of this class causes an
|
@@ -19,161 +18,84 @@
|
|
19
18
|
#
|
20
19
|
# First, what's elsewhere. Class Integer:
|
21
20
|
#
|
22
|
-
# * Inherits from [class
|
23
|
-
# Numeric](Numeric.html#class-Numeric-label-What-27s+Here).
|
21
|
+
# * Inherits from [class Numeric](rdoc-ref:Numeric@What-27s+Here).
|
24
22
|
#
|
25
23
|
#
|
26
24
|
# Here, class Integer provides methods for:
|
27
25
|
#
|
28
|
-
# * [Querying](
|
29
|
-
# * [Comparing](
|
30
|
-
# * [Converting](
|
31
|
-
# * [Other](
|
26
|
+
# * [Querying](rdoc-ref:Integer@Querying)
|
27
|
+
# * [Comparing](rdoc-ref:Integer@Comparing)
|
28
|
+
# * [Converting](rdoc-ref:Integer@Converting)
|
29
|
+
# * [Other](rdoc-ref:Integer@Other)
|
32
30
|
#
|
33
31
|
#
|
34
32
|
# ### Querying
|
35
33
|
#
|
36
|
-
#
|
37
|
-
#
|
38
|
-
#
|
39
|
-
# #anybits?
|
40
|
-
# : Returns whether any bits in `self` are set.
|
41
|
-
#
|
42
|
-
# #nobits?
|
43
|
-
# : Returns whether no bits in `self` are set.
|
44
|
-
#
|
34
|
+
# * #allbits?: Returns whether all bits in `self` are set.
|
35
|
+
# * #anybits?: Returns whether any bits in `self` are set.
|
36
|
+
# * #nobits?: Returns whether no bits in `self` are set.
|
45
37
|
#
|
46
38
|
#
|
47
39
|
# ### Comparing
|
48
40
|
#
|
49
|
-
#
|
50
|
-
#
|
51
|
-
#
|
52
|
-
#
|
53
|
-
# :
|
54
|
-
#
|
55
|
-
# [<=>](#method-i-3C-3D-3E)
|
56
|
-
# : Returns a number indicating whether `self` is less than, equal to, or
|
57
|
-
# greater than the given value.
|
58
|
-
#
|
59
|
-
# [==](#method-i-3D-3D) (aliased as #===)
|
60
|
-
# : Returns whether `self` is equal to the given value.
|
61
|
-
#
|
62
|
-
# [>](#method-i-3E)
|
63
|
-
# : Returns whether `self` is greater than the given value.
|
64
|
-
#
|
65
|
-
# [>=](#method-i-3E-3D)
|
66
|
-
# : Returns whether `self` is greater than or equal to the given value.
|
41
|
+
# * #<: Returns whether `self` is less than the given value.
|
42
|
+
# * #<=: Returns whether `self` is less than or equal to the given value.
|
43
|
+
# * #<=>: Returns a number indicating whether `self` is less than, equal to,
|
44
|
+
# or greater than the given value.
|
45
|
+
# * #== (aliased as #===): Returns whether `self` is equal to the given
|
46
|
+
# value.
|
67
47
|
#
|
48
|
+
# * #>: Returns whether `self` is greater than the given value.
|
49
|
+
# * #>=: Returns whether `self` is greater than or equal to the given value.
|
68
50
|
#
|
69
51
|
#
|
70
52
|
# ### Converting
|
71
53
|
#
|
72
|
-
#
|
73
|
-
# :
|
74
|
-
#
|
75
|
-
#
|
76
|
-
#
|
77
|
-
#
|
78
|
-
#
|
79
|
-
#
|
80
|
-
#
|
81
|
-
#
|
82
|
-
#
|
83
|
-
#
|
84
|
-
#
|
85
|
-
# :
|
86
|
-
#
|
87
|
-
#
|
88
|
-
# :
|
89
|
-
#
|
90
|
-
#
|
91
|
-
# :
|
92
|
-
#
|
93
|
-
#
|
94
|
-
# :
|
95
|
-
#
|
96
|
-
#
|
97
|
-
# :
|
98
|
-
#
|
99
|
-
#
|
100
|
-
#
|
101
|
-
#
|
102
|
-
#
|
103
|
-
#
|
104
|
-
#
|
105
|
-
#
|
106
|
-
#
|
107
|
-
#
|
108
|
-
# [^](#method-i-5E)
|
109
|
-
# : Returns the bitwise EXCLUSIVE OR of `self` and the given value.
|
110
|
-
#
|
111
|
-
# #ceil
|
112
|
-
# : Returns the smallest number greater than or equal to `self`.
|
113
|
-
#
|
114
|
-
# #chr
|
115
|
-
# : Returns a 1-character string containing the character represented by
|
116
|
-
# the value of `self`.
|
117
|
-
#
|
118
|
-
# #digits
|
119
|
-
# : Returns an array of integers representing the base-radix digits of
|
120
|
-
# `self`.
|
121
|
-
#
|
122
|
-
# #div
|
123
|
-
# : Returns the integer result of dividing `self` by the given value.
|
124
|
-
#
|
125
|
-
# #divmod
|
126
|
-
# : Returns a 2-element array containing the quotient and remainder
|
127
|
-
# results of dividing `self` by the given value.
|
128
|
-
#
|
129
|
-
# #fdiv
|
130
|
-
# : Returns the Float result of dividing `self` by the given value.
|
131
|
-
#
|
132
|
-
# #floor
|
133
|
-
# : Returns the greatest number smaller than or equal to `self`.
|
134
|
-
#
|
135
|
-
# #pow
|
136
|
-
# : Returns the modular exponentiation of `self`.
|
137
|
-
#
|
138
|
-
# #pred
|
139
|
-
# : Returns the integer predecessor of `self`.
|
140
|
-
#
|
141
|
-
# #remainder
|
142
|
-
# : Returns the remainder after dividing `self` by the given value.
|
143
|
-
#
|
144
|
-
# #round
|
145
|
-
# : Returns `self` rounded to the nearest value with the given precision.
|
146
|
-
#
|
147
|
-
# #succ (aliased as #next)
|
148
|
-
# : Returns the integer successor of `self`.
|
149
|
-
#
|
150
|
-
# #to_f
|
151
|
-
# : Returns `self` converted to a Float.
|
152
|
-
#
|
153
|
-
# #to_s (aliased as #inspect)
|
154
|
-
# : Returns a string containing the place-value representation of `self`
|
155
|
-
# in the given radix.
|
156
|
-
#
|
157
|
-
# #truncate
|
158
|
-
# : Returns `self` truncated to the given precision.
|
159
|
-
#
|
160
|
-
# [/](#method-i-7C)
|
161
|
-
# : Returns the bitwise OR of `self` and the given value.
|
162
|
-
#
|
54
|
+
# * ::sqrt: Returns the integer square root of the given value.
|
55
|
+
# * ::try_convert: Returns the given value converted to an Integer.
|
56
|
+
# * #% (aliased as #modulo): Returns `self` modulo the given value.
|
57
|
+
# * #&: Returns the bitwise AND of `self` and the given value.
|
58
|
+
# * #*: Returns the product of `self` and the given value.
|
59
|
+
# * #**: Returns the value of `self` raised to the power of the given value.
|
60
|
+
# * #+: Returns the sum of `self` and the given value.
|
61
|
+
# * #-: Returns the difference of `self` and the given value.
|
62
|
+
# * #/: Returns the quotient of `self` and the given value.
|
63
|
+
# * #<<: Returns the value of `self` after a leftward bit-shift.
|
64
|
+
# * #>>: Returns the value of `self` after a rightward bit-shift.
|
65
|
+
# * #[]: Returns a slice of bits from `self`.
|
66
|
+
# * #^: Returns the bitwise EXCLUSIVE OR of `self` and the given value.
|
67
|
+
# * #ceil: Returns the smallest number greater than or equal to `self`.
|
68
|
+
# * #chr: Returns a 1-character string containing the character represented by
|
69
|
+
# the value of `self`.
|
70
|
+
# * #digits: Returns an array of integers representing the base-radix digits
|
71
|
+
# of `self`.
|
72
|
+
# * #div: Returns the integer result of dividing `self` by the given value.
|
73
|
+
# * #divmod: Returns a 2-element array containing the quotient and remainder
|
74
|
+
# results of dividing `self` by the given value.
|
75
|
+
# * #fdiv: Returns the Float result of dividing `self` by the given value.
|
76
|
+
# * #floor: Returns the greatest number smaller than or equal to `self`.
|
77
|
+
# * #pow: Returns the modular exponentiation of `self`.
|
78
|
+
# * #pred: Returns the integer predecessor of `self`.
|
79
|
+
# * #remainder: Returns the remainder after dividing `self` by the given
|
80
|
+
# value.
|
81
|
+
# * #round: Returns `self` rounded to the nearest value with the given
|
82
|
+
# precision.
|
83
|
+
# * #succ (aliased as #next): Returns the integer successor of `self`.
|
84
|
+
# * #to_f: Returns `self` converted to a Float.
|
85
|
+
# * #to_s (aliased as #inspect): Returns a string containing the place-value
|
86
|
+
# representation of `self` in the given radix.
|
87
|
+
# * #truncate: Returns `self` truncated to the given precision.
|
88
|
+
# * #|: Returns the bitwise OR of `self` and the given value.
|
163
89
|
#
|
164
90
|
#
|
165
91
|
# ### Other
|
166
92
|
#
|
167
|
-
#
|
168
|
-
#
|
169
|
-
#
|
170
|
-
#
|
171
|
-
#
|
172
|
-
#
|
173
|
-
#
|
174
|
-
# #upto
|
175
|
-
# : Calls the given block with each integer value from `self` up to the
|
176
|
-
# given value.
|
93
|
+
# * #downto: Calls the given block with each integer value from `self` down to
|
94
|
+
# the given value.
|
95
|
+
# * #times: Calls the given block `self` times with each integer in
|
96
|
+
# `(0..self-1)`.
|
97
|
+
# * #upto: Calls the given block with each integer value from `self` up to the
|
98
|
+
# given value.
|
177
99
|
#
|
178
100
|
class Integer < Numeric
|
179
101
|
# <!--
|
@@ -731,6 +653,24 @@ class Integer < Numeric
|
|
731
653
|
def ceil: () -> Integer
|
732
654
|
| (int digits) -> (Integer | Float)
|
733
655
|
|
656
|
+
# <!--
|
657
|
+
# rdoc-file=numeric.rb
|
658
|
+
# - ceildiv(other) -> integer
|
659
|
+
# -->
|
660
|
+
# Returns the result of division `self` by `other`. The result is rounded up to
|
661
|
+
# the nearest integer.
|
662
|
+
#
|
663
|
+
# 3.ceildiv(3) # => 1
|
664
|
+
# 4.ceildiv(3) # => 2
|
665
|
+
#
|
666
|
+
# 4.ceildiv(-3) # => -1
|
667
|
+
# -4.ceildiv(3) # => -1
|
668
|
+
# -4.ceildiv(-3) # => 2
|
669
|
+
#
|
670
|
+
# 3.ceildiv(1.2) # => 3
|
671
|
+
#
|
672
|
+
def ceildiv: (Numeric other) -> Integer
|
673
|
+
|
734
674
|
# <!--
|
735
675
|
# rdoc-file=numeric.c
|
736
676
|
# - chr -> string
|
@@ -740,7 +680,7 @@ class Integer < Numeric
|
|
740
680
|
# of `self`, according to the given `encoding`.
|
741
681
|
#
|
742
682
|
# 65.chr # => "A"
|
743
|
-
# 0
|
683
|
+
# 0.chr # => "\x00"
|
744
684
|
# 255.chr # => "\xFF"
|
745
685
|
# string = 255.chr(Encoding::UTF_8)
|
746
686
|
# string.encoding # => Encoding::UTF_8
|
@@ -753,14 +693,14 @@ class Integer < Numeric
|
|
753
693
|
|
754
694
|
# <!--
|
755
695
|
# rdoc-file=bignum.c
|
756
|
-
# -
|
696
|
+
# - int.coerce(numeric) -> array
|
757
697
|
# -->
|
758
|
-
# Returns an array with both a `numeric` and a `
|
759
|
-
# objects.
|
698
|
+
# Returns an array with both a `numeric` and a `int` represented as Integer
|
699
|
+
# objects or Float objects.
|
760
700
|
#
|
761
|
-
# This is achieved by converting `numeric` to a
|
701
|
+
# This is achieved by converting `numeric` to an Integer or a Float.
|
762
702
|
#
|
763
|
-
# A TypeError is raised if the `numeric` is not
|
703
|
+
# A TypeError is raised if the `numeric` is not an Integer or a Float type.
|
764
704
|
#
|
765
705
|
# (0x3FFFFFFFFFFFFFFF+1).coerce(42) #=> [42, 4611686018427387904]
|
766
706
|
#
|
@@ -771,7 +711,7 @@ class Integer < Numeric
|
|
771
711
|
def conjugate: () -> Integer
|
772
712
|
|
773
713
|
# <!--
|
774
|
-
# rdoc-file=
|
714
|
+
# rdoc-file=numeric.rb
|
775
715
|
# - int.denominator -> 1
|
776
716
|
# -->
|
777
717
|
# Returns 1.
|
@@ -1065,7 +1005,7 @@ class Integer < Numeric
|
|
1065
1005
|
def nonzero?: () -> self?
|
1066
1006
|
|
1067
1007
|
# <!--
|
1068
|
-
# rdoc-file=
|
1008
|
+
# rdoc-file=numeric.rb
|
1069
1009
|
# - int.numerator -> self
|
1070
1010
|
# -->
|
1071
1011
|
# Returns self.
|