rbs 3.3.2 → 3.4.0.pre.1
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 -5
- data/.github/workflows/ruby.yml +7 -8
- data/.github/workflows/typecheck.yml +37 -0
- data/CHANGELOG.md +50 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +11 -11
- data/Steepfile +2 -2
- data/core/array.rbs +19 -49
- data/core/basic_object.rbs +2 -2
- data/core/comparable.rbs +17 -8
- data/core/complex.rbs +82 -43
- data/core/data.rbs +2 -4
- data/core/dir.rbs +635 -295
- data/core/enumerable.rbs +11 -18
- data/core/enumerator.rbs +37 -31
- data/core/errors.rbs +4 -0
- data/core/false_class.rbs +34 -15
- data/core/fiber.rbs +23 -0
- data/core/file.rbs +329 -120
- data/core/float.rbs +17 -32
- data/core/gc.rbs +17 -11
- data/core/hash.rbs +22 -44
- data/core/integer.rbs +82 -113
- data/core/io/buffer.rbs +90 -47
- data/core/io.rbs +39 -116
- data/core/kernel.rbs +442 -489
- data/core/match_data.rbs +55 -56
- data/core/module.rbs +45 -1
- data/core/nil_class.rbs +98 -35
- data/core/numeric.rbs +22 -32
- data/core/object_space/weak_key_map.rbs +102 -0
- data/core/process.rbs +1242 -655
- data/core/ractor.rbs +139 -120
- data/core/range.rbs +100 -4
- data/core/rational.rbs +0 -4
- data/core/rbs/unnamed/argf.rbs +16 -8
- data/core/rbs/unnamed/env_class.rbs +0 -24
- data/core/refinement.rbs +8 -0
- data/core/regexp.rbs +1149 -598
- data/core/ruby_vm.rbs +126 -12
- data/core/rubygems/platform.rbs +9 -0
- data/core/rubygems/rubygems.rbs +1 -1
- data/core/rubygems/version.rbs +5 -1
- data/core/set.rbs +20 -22
- data/core/signal.rbs +4 -4
- data/core/string.rbs +283 -230
- data/core/string_io.rbs +2 -14
- data/core/struct.rbs +404 -24
- data/core/symbol.rbs +1 -19
- data/core/thread.rbs +29 -12
- data/core/time.rbs +227 -104
- data/core/trace_point.rbs +2 -5
- data/core/true_class.rbs +54 -21
- data/core/warning.rbs +14 -11
- data/docs/data_and_struct.md +29 -0
- data/docs/syntax.md +3 -5
- data/docs/tools.md +1 -0
- data/ext/rbs_extension/lexer.c +643 -559
- data/ext/rbs_extension/lexer.re +5 -1
- data/ext/rbs_extension/parser.c +12 -3
- data/ext/rbs_extension/unescape.c +7 -47
- data/lib/rbs/cli/diff.rb +4 -1
- data/lib/rbs/cli/validate.rb +280 -0
- data/lib/rbs/cli.rb +2 -194
- data/lib/rbs/collection/config.rb +5 -6
- data/lib/rbs/collection/sources/git.rb +1 -1
- data/lib/rbs/collection.rb +1 -0
- data/lib/rbs/diff.rb +7 -4
- data/lib/rbs/errors.rb +11 -0
- data/lib/rbs/test/errors.rb +4 -1
- data/lib/rbs/test/guaranteed.rb +2 -3
- data/lib/rbs/test/type_check.rb +15 -10
- data/lib/rbs/test.rb +3 -3
- data/lib/rbs/types.rb +29 -0
- data/lib/rbs/unit_test/convertibles.rb +176 -0
- data/lib/rbs/unit_test/spy.rb +136 -0
- data/lib/rbs/unit_test/type_assertions.rb +341 -0
- data/lib/rbs/unit_test/with_aliases.rb +143 -0
- data/lib/rbs/unit_test.rb +6 -0
- data/lib/rbs/version.rb +1 -1
- data/sig/cli/validate.rbs +43 -0
- data/sig/diff.rbs +3 -1
- data/sig/errors.rbs +8 -0
- data/sig/rbs.rbs +1 -1
- data/sig/test/errors.rbs +52 -0
- data/sig/test/guranteed.rbs +9 -0
- data/sig/test/type_check.rbs +19 -0
- data/sig/test.rbs +82 -0
- data/sig/types.rbs +6 -1
- data/sig/unit_test/convertibles.rbs +154 -0
- data/sig/unit_test/spy.rbs +28 -0
- data/sig/unit_test/type_assertions.rbs +194 -0
- data/sig/unit_test/with_aliases.rbs +136 -0
- data/stdlib/base64/0/base64.rbs +307 -45
- data/stdlib/bigdecimal/0/big_decimal.rbs +35 -15
- data/stdlib/coverage/0/coverage.rbs +2 -2
- data/stdlib/csv/0/csv.rbs +25 -55
- data/stdlib/date/0/date.rbs +1 -43
- data/stdlib/date/0/date_time.rbs +1 -13
- data/stdlib/delegate/0/delegator.rbs +186 -0
- data/stdlib/delegate/0/kernel.rbs +47 -0
- data/stdlib/delegate/0/simple_delegator.rbs +98 -0
- data/stdlib/did_you_mean/0/did_you_mean.rbs +1 -1
- data/stdlib/erb/0/erb.rbs +2 -2
- data/stdlib/fileutils/0/fileutils.rbs +0 -19
- data/stdlib/io-console/0/io-console.rbs +12 -1
- data/stdlib/ipaddr/0/ipaddr.rbs +2 -1
- data/stdlib/json/0/json.rbs +320 -81
- data/stdlib/logger/0/logger.rbs +9 -5
- data/stdlib/monitor/0/monitor.rbs +78 -0
- data/stdlib/net-http/0/net-http.rbs +1880 -543
- data/stdlib/objspace/0/objspace.rbs +19 -13
- data/stdlib/openssl/0/openssl.rbs +508 -127
- data/stdlib/optparse/0/optparse.rbs +25 -11
- data/stdlib/pathname/0/pathname.rbs +1 -1
- data/stdlib/pp/0/pp.rbs +2 -5
- data/stdlib/prettyprint/0/prettyprint.rbs +2 -2
- data/stdlib/pstore/0/pstore.rbs +2 -4
- data/stdlib/rdoc/0/comment.rbs +1 -2
- data/stdlib/resolv/0/resolv.rbs +4 -2
- data/stdlib/socket/0/socket.rbs +2 -2
- data/stdlib/socket/0/unix_socket.rbs +2 -2
- data/stdlib/strscan/0/string_scanner.rbs +3 -2
- data/stdlib/tempfile/0/tempfile.rbs +1 -1
- data/stdlib/uri/0/common.rbs +245 -123
- metadata +23 -4
- data/lib/rbs/test/spy.rb +0 -6
data/stdlib/logger/0/logger.rbs
CHANGED
@@ -245,8 +245,7 @@
|
|
245
245
|
# logger.error! # => 3
|
246
246
|
# logger.fatal! # => 4
|
247
247
|
#
|
248
|
-
# You can retrieve the log level with method
|
249
|
-
# [level](Logger.html#attribute-i-level):
|
248
|
+
# You can retrieve the log level with method #level.
|
250
249
|
#
|
251
250
|
# logger.level = Logger::ERROR
|
252
251
|
# logger.level # => 3
|
@@ -619,7 +618,10 @@ class Logger
|
|
619
618
|
#
|
620
619
|
def info?: () -> bool
|
621
620
|
|
622
|
-
# <!--
|
621
|
+
# <!--
|
622
|
+
# rdoc-file=lib/logger.rb
|
623
|
+
# - level()
|
624
|
+
# -->
|
623
625
|
# Logging severity threshold (e.g. `Logger::INFO`).
|
624
626
|
#
|
625
627
|
def level: () -> Integer
|
@@ -689,8 +691,10 @@ class Logger
|
|
689
691
|
def reopen: () -> self
|
690
692
|
| (logdev?) -> self
|
691
693
|
|
692
|
-
# <!--
|
693
|
-
#
|
694
|
+
# <!--
|
695
|
+
# rdoc-file=lib/logger.rb
|
696
|
+
# - sev_threshold()
|
697
|
+
# -->
|
694
698
|
#
|
695
699
|
alias sev_threshold level
|
696
700
|
|
@@ -109,6 +109,84 @@ class Monitor
|
|
109
109
|
def wait_for_cond: (::MonitorMixin::ConditionVariable, Numeric? timeout) -> untyped
|
110
110
|
end
|
111
111
|
|
112
|
+
# <!-- rdoc-file=ext/monitor/lib/monitor.rb -->
|
113
|
+
# In concurrent programming, a monitor is an object or module intended to be
|
114
|
+
# used safely by more than one thread. The defining characteristic of a monitor
|
115
|
+
# is that its methods are executed with mutual exclusion. That is, at each point
|
116
|
+
# in time, at most one thread may be executing any of its methods. This mutual
|
117
|
+
# exclusion greatly simplifies reasoning about the implementation of monitors
|
118
|
+
# compared to reasoning about parallel code that updates a data structure.
|
119
|
+
#
|
120
|
+
# You can read more about the general principles on the Wikipedia page for
|
121
|
+
# [Monitors](https://en.wikipedia.org/wiki/Monitor_%28synchronization%29).
|
122
|
+
#
|
123
|
+
# ## Examples
|
124
|
+
#
|
125
|
+
# ### Simple object.extend
|
126
|
+
#
|
127
|
+
# require 'monitor.rb'
|
128
|
+
#
|
129
|
+
# buf = []
|
130
|
+
# buf.extend(MonitorMixin)
|
131
|
+
# empty_cond = buf.new_cond
|
132
|
+
#
|
133
|
+
# # consumer
|
134
|
+
# Thread.start do
|
135
|
+
# loop do
|
136
|
+
# buf.synchronize do
|
137
|
+
# empty_cond.wait_while { buf.empty? }
|
138
|
+
# print buf.shift
|
139
|
+
# end
|
140
|
+
# end
|
141
|
+
# end
|
142
|
+
#
|
143
|
+
# # producer
|
144
|
+
# while line = ARGF.gets
|
145
|
+
# buf.synchronize do
|
146
|
+
# buf.push(line)
|
147
|
+
# empty_cond.signal
|
148
|
+
# end
|
149
|
+
# end
|
150
|
+
#
|
151
|
+
# The consumer thread waits for the producer thread to push a line to buf while
|
152
|
+
# `buf.empty?`. The producer thread (main thread) reads a line from ARGF and
|
153
|
+
# pushes it into buf then calls `empty_cond.signal` to notify the consumer
|
154
|
+
# thread of new data.
|
155
|
+
#
|
156
|
+
# ### Simple Class include
|
157
|
+
#
|
158
|
+
# require 'monitor'
|
159
|
+
#
|
160
|
+
# class SynchronizedArray < Array
|
161
|
+
#
|
162
|
+
# include MonitorMixin
|
163
|
+
#
|
164
|
+
# def initialize(*args)
|
165
|
+
# super(*args)
|
166
|
+
# end
|
167
|
+
#
|
168
|
+
# alias :old_shift :shift
|
169
|
+
# alias :old_unshift :unshift
|
170
|
+
#
|
171
|
+
# def shift(n=1)
|
172
|
+
# self.synchronize do
|
173
|
+
# self.old_shift(n)
|
174
|
+
# end
|
175
|
+
# end
|
176
|
+
#
|
177
|
+
# def unshift(item)
|
178
|
+
# self.synchronize do
|
179
|
+
# self.old_unshift(item)
|
180
|
+
# end
|
181
|
+
# end
|
182
|
+
#
|
183
|
+
# # other methods ...
|
184
|
+
# end
|
185
|
+
#
|
186
|
+
# `SynchronizedArray` implements an Array with synchronized access to items.
|
187
|
+
# This Class is implemented as subclass of Array which includes the MonitorMixin
|
188
|
+
# module.
|
189
|
+
#
|
112
190
|
module MonitorMixin
|
113
191
|
# <!--
|
114
192
|
# rdoc-file=ext/monitor/lib/monitor.rb
|