rbs 0.16.0 → 0.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +1 -1
- data/CHANGELOG.md +30 -0
- data/README.md +1 -1
- data/Rakefile +12 -1
- data/core/array.rbs +1 -1
- data/core/builtin.rbs +2 -2
- data/core/dir.rbs +1 -1
- data/core/enumerable.rbs +41 -40
- data/core/enumerator.rbs +5 -5
- data/core/file.rbs +0 -4
- data/core/hash.rbs +9 -11
- data/core/io.rbs +1 -1
- data/core/object_space.rbs +98 -0
- data/core/range.rbs +1 -1
- data/core/struct.rbs +1 -1
- data/core/time.rbs +0 -12
- data/lib/rbs/ast/members.rb +9 -3
- data/lib/rbs/definition.rb +9 -4
- data/lib/rbs/definition_builder.rb +123 -71
- data/lib/rbs/environment.rb +3 -0
- data/lib/rbs/environment_loader.rb +1 -1
- data/lib/rbs/environment_walker.rb +70 -35
- data/lib/rbs/method_type.rb +1 -31
- data/lib/rbs/parser.rb +944 -879
- data/lib/rbs/parser.y +110 -63
- data/lib/rbs/prototype/rb.rb +163 -23
- data/lib/rbs/prototype/rbi.rb +5 -5
- data/lib/rbs/prototype/runtime.rb +2 -1
- data/lib/rbs/test/hook.rb +30 -17
- data/lib/rbs/test/type_check.rb +6 -1
- data/lib/rbs/types.rb +63 -6
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs/writer.rb +9 -1
- data/schema/members.json +5 -1
- data/sig/definition.rbs +8 -3
- data/sig/definition_builder.rbs +6 -2
- data/sig/members.rbs +4 -1
- data/sig/method_types.rbs +3 -16
- data/sig/types.rbs +17 -1
- data/stdlib/csv/0/csv.rbs +3 -3
- data/stdlib/dbm/0/dbm.rbs +1 -3
- data/stdlib/monitor/0/monitor.rbs +119 -0
- data/stdlib/prime/0/prime.rbs +1 -1
- data/stdlib/set/0/set.rbs +10 -10
- data/stdlib/singleton/0/singleton.rbs +111 -0
- data/stdlib/tsort/0/cyclic.rbs +4 -0
- data/stdlib/tsort/0/interfaces.rbs +19 -0
- data/stdlib/tsort/0/tsort.rbs +371 -0
- data/stdlib/yaml/0/dbm.rbs +221 -0
- data/stdlib/yaml/0/store.rbs +53 -0
- data/steep/Gemfile.lock +12 -12
- metadata +11 -3
@@ -0,0 +1,221 @@
|
|
1
|
+
# YAML Ain't Markup Language
|
2
|
+
#
|
3
|
+
# This module provides a Ruby interface for data serialization in YAML format.
|
4
|
+
#
|
5
|
+
# The YAML module is an alias of Psych, the YAML engine for Ruby.
|
6
|
+
#
|
7
|
+
# ## Usage
|
8
|
+
#
|
9
|
+
# Working with YAML can be very simple, for example:
|
10
|
+
#
|
11
|
+
# require 'yaml'
|
12
|
+
# # Parse a YAML string
|
13
|
+
# YAML.load("--- foo") #=> "foo"
|
14
|
+
#
|
15
|
+
# # Emit some YAML
|
16
|
+
# YAML.dump("foo") # => "--- foo\n...\n"
|
17
|
+
# { :a => 'b'}.to_yaml # => "---\n:a: b\n"
|
18
|
+
#
|
19
|
+
# As the implementation is provided by the Psych library, detailed documentation
|
20
|
+
# can be found in that library's docs (also part of standard library).
|
21
|
+
#
|
22
|
+
# ## Security
|
23
|
+
#
|
24
|
+
# Do not use YAML to load untrusted data. Doing so is unsafe and could allow
|
25
|
+
# malicious input to execute arbitrary code inside your application. Please see
|
26
|
+
# doc/security.rdoc for more information.
|
27
|
+
#
|
28
|
+
# ## History
|
29
|
+
#
|
30
|
+
# Syck was the original for YAML implementation in Ruby's standard library
|
31
|
+
# developed by why the lucky stiff.
|
32
|
+
#
|
33
|
+
# You can still use Syck, if you prefer, for parsing and emitting YAML, but you
|
34
|
+
# must install the 'syck' gem now in order to use it.
|
35
|
+
#
|
36
|
+
# In older Ruby versions, ie. <= 1.9, Syck is still provided, however it was
|
37
|
+
# completely removed with the release of Ruby 2.0.0.
|
38
|
+
#
|
39
|
+
# ## More info
|
40
|
+
#
|
41
|
+
# For more advanced details on the implementation see Psych, and also check out
|
42
|
+
# http://yaml.org for spec details and other helpful information.
|
43
|
+
#
|
44
|
+
# Psych is maintained by Aaron Patterson on github:
|
45
|
+
# https://github.com/ruby/psych
|
46
|
+
#
|
47
|
+
# Syck can also be found on github: https://github.com/ruby/syck
|
48
|
+
#
|
49
|
+
module YAML
|
50
|
+
# YAML + DBM = YDBM
|
51
|
+
#
|
52
|
+
# YAML::DBM provides the same interface as ::DBM.
|
53
|
+
#
|
54
|
+
# However, while DBM only allows strings for both keys and values,
|
55
|
+
# this library allows one to use most Ruby objects for values
|
56
|
+
# by first converting them to YAML. Keys must be strings.
|
57
|
+
#
|
58
|
+
# Conversion to and from YAML is performed automatically.
|
59
|
+
#
|
60
|
+
# See the documentation for ::DBM and ::YAML for more information.
|
61
|
+
class DBM < ::DBM
|
62
|
+
VERSION: ::String
|
63
|
+
|
64
|
+
# :call-seq:
|
65
|
+
# ydbm[key] -> value
|
66
|
+
#
|
67
|
+
# Return value associated with +key+ from database.
|
68
|
+
#
|
69
|
+
# Returns +nil+ if there is no such +key+.
|
70
|
+
#
|
71
|
+
# See #fetch for more information.
|
72
|
+
def []: (String key) -> untyped
|
73
|
+
|
74
|
+
# :call-seq:
|
75
|
+
# ydbm[key] = value
|
76
|
+
#
|
77
|
+
# Set +key+ to +value+ in database.
|
78
|
+
#
|
79
|
+
# +value+ will be converted to YAML before storage.
|
80
|
+
#
|
81
|
+
# See #store for more information.
|
82
|
+
def []=: (String key, untyped val) -> untyped
|
83
|
+
|
84
|
+
# :call-seq:
|
85
|
+
# ydbm.fetch( key, ifnone = nil )
|
86
|
+
# ydbm.fetch( key ) { |key| ... }
|
87
|
+
#
|
88
|
+
# Return value associated with +key+.
|
89
|
+
#
|
90
|
+
# If there is no value for +key+ and no block is given, returns +ifnone+.
|
91
|
+
#
|
92
|
+
# Otherwise, calls block passing in the given +key+.
|
93
|
+
#
|
94
|
+
# See ::DBM#fetch for more information.
|
95
|
+
def fetch: (String keystr, ?untyped? ifnone) { (untyped) -> untyped } -> untyped
|
96
|
+
|
97
|
+
# Deprecated, used YAML::DBM#key instead.
|
98
|
+
# ----
|
99
|
+
# Note:
|
100
|
+
# YAML::DBM#index makes warning from internal of ::DBM#index.
|
101
|
+
# It says 'DBM#index is deprecated; use DBM#key', but DBM#key
|
102
|
+
# behaves not same as DBM#index.
|
103
|
+
#
|
104
|
+
def index: (String keystr) -> untyped
|
105
|
+
|
106
|
+
# :call-seq:
|
107
|
+
# ydbm.key(value) -> string
|
108
|
+
#
|
109
|
+
# Returns the key for the specified value.
|
110
|
+
def key: (String keystr) -> String
|
111
|
+
|
112
|
+
# :call-seq:
|
113
|
+
# ydbm.values_at(*keys)
|
114
|
+
#
|
115
|
+
# Returns an array containing the values associated with the given keys.
|
116
|
+
def values_at: (*untyped keys) -> Array[untyped]
|
117
|
+
|
118
|
+
# :call-seq:
|
119
|
+
# ydbm.delete(key)
|
120
|
+
#
|
121
|
+
# Deletes value from database associated with +key+.
|
122
|
+
#
|
123
|
+
# Returns value or +nil+.
|
124
|
+
def delete: (String key) -> untyped
|
125
|
+
|
126
|
+
def delete_if: () { (untyped, untyped) -> untyped } -> untyped
|
127
|
+
|
128
|
+
# :call-seq:
|
129
|
+
# ydbm.reject { |key, value| ... }
|
130
|
+
#
|
131
|
+
# Converts the contents of the database to an in-memory Hash, then calls
|
132
|
+
# Hash#reject with the specified code block, returning a new Hash.
|
133
|
+
def reject: () { (untyped, untyped) -> untyped } -> Hash[untyped, untyped]
|
134
|
+
|
135
|
+
def each_pair: () { (untyped, untyped) -> untyped } -> untyped
|
136
|
+
|
137
|
+
def each_value: () { (untyped) -> untyped } -> untyped
|
138
|
+
|
139
|
+
# :call-seq:
|
140
|
+
# ydbm.values
|
141
|
+
#
|
142
|
+
# Returns an array of values from the database.
|
143
|
+
def values: () -> untyped
|
144
|
+
|
145
|
+
# :call-seq:
|
146
|
+
# ydbm.has_value?(value)
|
147
|
+
#
|
148
|
+
# Returns true if specified +value+ is found in the database.
|
149
|
+
def has_value?: (untyped val) -> (::TrueClass | ::FalseClass)
|
150
|
+
|
151
|
+
# :call-seq:
|
152
|
+
# ydbm.invert -> hash
|
153
|
+
#
|
154
|
+
# Returns a Hash (not a DBM database) created by using each value in the
|
155
|
+
# database as a key, with the corresponding key as its value.
|
156
|
+
#
|
157
|
+
# Note that all values in the hash will be Strings, but the keys will be
|
158
|
+
# actual objects.
|
159
|
+
def invert: () -> Hash[untyped, untyped]
|
160
|
+
|
161
|
+
# :call-seq:
|
162
|
+
# ydbm.replace(hash) -> ydbm
|
163
|
+
#
|
164
|
+
# Replaces the contents of the database with the contents of the specified
|
165
|
+
# object. Takes any object which implements the each_pair method, including
|
166
|
+
# Hash and DBM objects.
|
167
|
+
def replace: (Hash[untyped, untyped] | DBM hsh) -> YAML::DBM
|
168
|
+
|
169
|
+
# :call-seq:
|
170
|
+
# ydbm.shift -> [key, value]
|
171
|
+
#
|
172
|
+
# Removes a [key, value] pair from the database, and returns it.
|
173
|
+
# If the database is empty, returns +nil+.
|
174
|
+
#
|
175
|
+
# The order in which values are removed/returned is not guaranteed.
|
176
|
+
def shift: () -> (Array[untyped] | untyped)
|
177
|
+
|
178
|
+
# :call-seq:
|
179
|
+
# ydbm.select { |key, value| ... }
|
180
|
+
# ydbm.select(*keys)
|
181
|
+
#
|
182
|
+
# If a block is provided, returns a new array containing [key, value] pairs
|
183
|
+
# for which the block returns true.
|
184
|
+
#
|
185
|
+
# Otherwise, same as #values_at
|
186
|
+
def select: (*untyped keys) { (untyped, untyped) -> untyped } -> Array[untyped]
|
187
|
+
|
188
|
+
# :call-seq:
|
189
|
+
# ydbm.store(key, value) -> value
|
190
|
+
#
|
191
|
+
# Stores +value+ in database with +key+ as the index. +value+ is converted
|
192
|
+
# to YAML before being stored.
|
193
|
+
#
|
194
|
+
# Returns +value+
|
195
|
+
def store: (String key, untyped val) -> untyped
|
196
|
+
|
197
|
+
# :call-seq:
|
198
|
+
# ydbm.update(hash) -> ydbm
|
199
|
+
#
|
200
|
+
# Updates the database with multiple values from the specified object.
|
201
|
+
# Takes any object which implements the each_pair method, including
|
202
|
+
# Hash and DBM objects.
|
203
|
+
#
|
204
|
+
# Returns +self+.
|
205
|
+
def update: (Hash[untyped, untyped]) -> YAML::DBM
|
206
|
+
|
207
|
+
# :call-seq:
|
208
|
+
# ydbm.to_a -> array
|
209
|
+
#
|
210
|
+
# Converts the contents of the database to an array of [key, value] arrays,
|
211
|
+
# and returns it.
|
212
|
+
def to_a: () -> Array [untyped]
|
213
|
+
|
214
|
+
# :call-seq:
|
215
|
+
# ydbm.to_hash -> hash
|
216
|
+
#
|
217
|
+
# Converts the contents of the database to an in-memory Hash object, and
|
218
|
+
# returns it.
|
219
|
+
def to_hash: () -> Hash[untyped, untyped]
|
220
|
+
end
|
221
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# YAML::Store provides the same functionality as PStore, except it uses YAML to
|
2
|
+
# dump objects instead of Marshal.
|
3
|
+
#
|
4
|
+
# ## Example
|
5
|
+
#
|
6
|
+
# require 'yaml/store'
|
7
|
+
#
|
8
|
+
# Person = Struct.new :first_name, :last_name
|
9
|
+
#
|
10
|
+
# people = [Person.new("Bob", "Smith"), Person.new("Mary", "Johnson")]
|
11
|
+
#
|
12
|
+
# store = YAML::Store.new "test.store"
|
13
|
+
#
|
14
|
+
# store.transaction do
|
15
|
+
# store["people"] = people
|
16
|
+
# store["greeting"] = { "hello" => "world" }
|
17
|
+
# end
|
18
|
+
#
|
19
|
+
# After running the above code, the contents of "test.store" will be:
|
20
|
+
#
|
21
|
+
# ---
|
22
|
+
# people:
|
23
|
+
# - !ruby/struct:Person
|
24
|
+
# first_name: Bob
|
25
|
+
# last_name: Smith
|
26
|
+
# - !ruby/struct:Person
|
27
|
+
# first_name: Mary
|
28
|
+
# last_name: Johnson
|
29
|
+
# greeting:
|
30
|
+
# hello: world
|
31
|
+
#
|
32
|
+
class YAML::Store < ::PStore
|
33
|
+
# Creates a new YAML::Store object, which will store data in `file_name`. If the
|
34
|
+
# file does not already exist, it will be created.
|
35
|
+
#
|
36
|
+
# YAML::Store objects are always reentrant. But if *thread_safe* is set to true,
|
37
|
+
# then it will become thread-safe at the cost of a minor performance hit.
|
38
|
+
#
|
39
|
+
# Options passed in through `yaml_opts` will be used when converting the store
|
40
|
+
# to YAML via Hash#to_yaml().
|
41
|
+
#
|
42
|
+
def initialize: (*untyped o) -> YAML::Store
|
43
|
+
|
44
|
+
def dump: (untyped table) -> String
|
45
|
+
|
46
|
+
def empty_marshal_checksum: () -> String
|
47
|
+
|
48
|
+
def empty_marshal_data: () -> String
|
49
|
+
|
50
|
+
def load: (String) -> untyped
|
51
|
+
|
52
|
+
def marshal_dump_supports_canonical_option?: () -> ::FalseClass
|
53
|
+
end
|
data/steep/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
activesupport (6.0.3.
|
4
|
+
activesupport (6.0.3.4)
|
5
5
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
6
6
|
i18n (>= 0.7, < 2)
|
7
7
|
minitest (~> 5.1)
|
@@ -15,31 +15,31 @@ GEM
|
|
15
15
|
ffi (1.13.1)
|
16
16
|
i18n (1.8.5)
|
17
17
|
concurrent-ruby (~> 1.0)
|
18
|
-
language_server-protocol (3.
|
19
|
-
listen (3.
|
18
|
+
language_server-protocol (3.15.0.1)
|
19
|
+
listen (3.3.3)
|
20
20
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
21
21
|
rb-inotify (~> 0.9, >= 0.9.10)
|
22
22
|
minitest (5.14.2)
|
23
|
-
parser (2.7.
|
23
|
+
parser (2.7.2.0)
|
24
24
|
ast (~> 2.4.1)
|
25
25
|
rainbow (3.0.0)
|
26
26
|
rb-fsevent (0.10.4)
|
27
27
|
rb-inotify (0.10.1)
|
28
28
|
ffi (~> 1.0)
|
29
|
-
rbs (0.
|
30
|
-
steep (0.
|
29
|
+
rbs (0.17.0)
|
30
|
+
steep (0.36.0)
|
31
31
|
activesupport (>= 5.1)
|
32
32
|
ast_utils (~> 0.3.0)
|
33
|
-
language_server-protocol (~> 3.
|
34
|
-
listen (~> 3.
|
33
|
+
language_server-protocol (~> 3.15.0.1)
|
34
|
+
listen (~> 3.0)
|
35
35
|
parser (~> 2.7.0)
|
36
36
|
rainbow (>= 2.2.2, < 4.0)
|
37
|
-
rbs (~> 0.
|
37
|
+
rbs (~> 0.17.0)
|
38
38
|
thor (1.0.1)
|
39
39
|
thread_safe (0.3.6)
|
40
|
-
tzinfo (1.2.
|
40
|
+
tzinfo (1.2.8)
|
41
41
|
thread_safe (~> 0.1)
|
42
|
-
zeitwerk (2.4.
|
42
|
+
zeitwerk (2.4.2)
|
43
43
|
|
44
44
|
PLATFORMS
|
45
45
|
ruby
|
@@ -48,4 +48,4 @@ DEPENDENCIES
|
|
48
48
|
steep
|
49
49
|
|
50
50
|
BUNDLED WITH
|
51
|
-
2.
|
51
|
+
2.2.0.rc.2
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.20.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Soutaro Matsumoto
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: RBS is the language for type signatures for Ruby and standard library
|
14
14
|
definitions.
|
@@ -74,6 +74,7 @@ files:
|
|
74
74
|
- core/nil_class.rbs
|
75
75
|
- core/numeric.rbs
|
76
76
|
- core/object.rbs
|
77
|
+
- core/object_space.rbs
|
77
78
|
- core/proc.rbs
|
78
79
|
- core/process.rbs
|
79
80
|
- core/random.rbs
|
@@ -205,6 +206,7 @@ files:
|
|
205
206
|
- stdlib/logger/0/logger.rbs
|
206
207
|
- stdlib/logger/0/period.rbs
|
207
208
|
- stdlib/logger/0/severity.rbs
|
209
|
+
- stdlib/monitor/0/monitor.rbs
|
208
210
|
- stdlib/mutex_m/0/mutex_m.rbs
|
209
211
|
- stdlib/pathname/0/pathname.rbs
|
210
212
|
- stdlib/prime/0/integer-extension.rbs
|
@@ -213,13 +215,19 @@ files:
|
|
213
215
|
- stdlib/pty/0/pty.rbs
|
214
216
|
- stdlib/securerandom/0/securerandom.rbs
|
215
217
|
- stdlib/set/0/set.rbs
|
218
|
+
- stdlib/singleton/0/singleton.rbs
|
216
219
|
- stdlib/tmpdir/0/tmpdir.rbs
|
220
|
+
- stdlib/tsort/0/cyclic.rbs
|
221
|
+
- stdlib/tsort/0/interfaces.rbs
|
222
|
+
- stdlib/tsort/0/tsort.rbs
|
217
223
|
- stdlib/uri/0/file.rbs
|
218
224
|
- stdlib/uri/0/generic.rbs
|
219
225
|
- stdlib/uri/0/http.rbs
|
220
226
|
- stdlib/uri/0/https.rbs
|
221
227
|
- stdlib/uri/0/ldap.rbs
|
222
228
|
- stdlib/uri/0/ldaps.rbs
|
229
|
+
- stdlib/yaml/0/dbm.rbs
|
230
|
+
- stdlib/yaml/0/store.rbs
|
223
231
|
- stdlib/zlib/0/zlib.rbs
|
224
232
|
- steep/Gemfile
|
225
233
|
- steep/Gemfile.lock
|
@@ -246,7 +254,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
246
254
|
- !ruby/object:Gem::Version
|
247
255
|
version: '0'
|
248
256
|
requirements: []
|
249
|
-
rubygems_version: 3.
|
257
|
+
rubygems_version: 3.2.0.rc.2
|
250
258
|
signing_key:
|
251
259
|
specification_version: 4
|
252
260
|
summary: Type signature for Ruby.
|