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/ruby_vm.rbs
CHANGED
@@ -51,3 +51,213 @@ RubyVM::OPTS: Array[String]
|
|
51
51
|
#
|
52
52
|
class RubyVM::InstructionSequence < Object
|
53
53
|
end
|
54
|
+
|
55
|
+
# <!-- rdoc-file=ast.rb -->
|
56
|
+
# AbstractSyntaxTree provides methods to parse Ruby code into abstract syntax
|
57
|
+
# trees. The nodes in the tree are instances of
|
58
|
+
# RubyVM::AbstractSyntaxTree::Node.
|
59
|
+
#
|
60
|
+
# This module is MRI specific as it exposes implementation details of the MRI
|
61
|
+
# abstract syntax tree.
|
62
|
+
#
|
63
|
+
# This module is experimental and its API is not stable, therefore it might
|
64
|
+
# change without notice. As examples, the order of children nodes is not
|
65
|
+
# guaranteed, the number of children nodes might change, there is no way to
|
66
|
+
# access children nodes by name, etc.
|
67
|
+
#
|
68
|
+
# If you are looking for a stable API or an API working under multiple Ruby
|
69
|
+
# implementations, consider using the *parser* gem or Ripper. If you would like
|
70
|
+
# to make RubyVM::AbstractSyntaxTree stable, please join the discussion at
|
71
|
+
# https://bugs.ruby-lang.org/issues/14844.
|
72
|
+
#
|
73
|
+
module RubyVM::AbstractSyntaxTree
|
74
|
+
# <!--
|
75
|
+
# rdoc-file=ast.rb
|
76
|
+
# - RubyVM::AbstractSyntaxTree.parse(string, keep_script_lines: false, error_tolerant: false, keep_tokens: false) -> RubyVM::AbstractSyntaxTree::Node
|
77
|
+
# -->
|
78
|
+
# Parses the given *string* into an abstract syntax tree, returning the root
|
79
|
+
# node of that tree.
|
80
|
+
#
|
81
|
+
# RubyVM::AbstractSyntaxTree.parse("x = 1 + 2")
|
82
|
+
# # => #<RubyVM::AbstractSyntaxTree::Node:SCOPE@1:0-1:9>
|
83
|
+
#
|
84
|
+
# If `keep_script_lines: true` option is provided, the text of the parsed source
|
85
|
+
# is associated with nodes and is available via Node#script_lines.
|
86
|
+
#
|
87
|
+
# If `keep_tokens: true` option is provided, Node#tokens are populated.
|
88
|
+
#
|
89
|
+
# SyntaxError is raised if the given *string* is invalid syntax. To overwrite
|
90
|
+
# this behavior, `error_tolerant: true` can be provided. In this case, the
|
91
|
+
# parser will produce a tree where expressions with syntax errors would be
|
92
|
+
# represented by Node with `type=:ERROR`.
|
93
|
+
#
|
94
|
+
# root = RubyVM::AbstractSyntaxTree.parse("x = 1; p(x; y=2")
|
95
|
+
# # <internal:ast>:33:in `parse': syntax error, unexpected ';', expecting ')' (SyntaxError)
|
96
|
+
# # x = 1; p(x; y=2
|
97
|
+
# # ^
|
98
|
+
#
|
99
|
+
# root = RubyVM::AbstractSyntaxTree.parse("x = 1; p(x; y=2", error_tolerant: true)
|
100
|
+
# # (SCOPE@1:0-1:15
|
101
|
+
# # tbl: [:x, :y]
|
102
|
+
# # args: nil
|
103
|
+
# # body: (BLOCK@1:0-1:15 (LASGN@1:0-1:5 :x (LIT@1:4-1:5 1)) (ERROR@1:7-1:11) (LASGN@1:12-1:15 :y (LIT@1:14-1:15 2))))
|
104
|
+
# root.children.last.children
|
105
|
+
# # [(LASGN@1:0-1:5 :x (LIT@1:4-1:5 1)),
|
106
|
+
# # (ERROR@1:7-1:11),
|
107
|
+
# # (LASGN@1:12-1:15 :y (LIT@1:14-1:15 2))]
|
108
|
+
#
|
109
|
+
# Note that parsing continues even after the errored expresion.
|
110
|
+
#
|
111
|
+
def self.parse: (String string, ?keep_script_lines: bool, ?error_tolerant: bool, ?keep_tokens: bool) -> Node
|
112
|
+
|
113
|
+
# <!--
|
114
|
+
# rdoc-file=ast.rb
|
115
|
+
# - RubyVM::AbstractSyntaxTree.parse_file(pathname, keep_script_lines: false, error_tolerant: false, keep_tokens: false) -> RubyVM::AbstractSyntaxTree::Node
|
116
|
+
# -->
|
117
|
+
# Reads the file from *pathname*, then parses it like ::parse, returning the
|
118
|
+
# root node of the abstract syntax tree.
|
119
|
+
#
|
120
|
+
# SyntaxError is raised if *pathname*'s contents are not valid Ruby syntax.
|
121
|
+
#
|
122
|
+
# RubyVM::AbstractSyntaxTree.parse_file("my-app/app.rb")
|
123
|
+
# # => #<RubyVM::AbstractSyntaxTree::Node:SCOPE@1:0-31:3>
|
124
|
+
#
|
125
|
+
# See ::parse for explanation of keyword argument meaning and usage.
|
126
|
+
#
|
127
|
+
def self.parse_file: (String | ::_ToPath string, ?keep_script_lines: bool, ?error_tolerant: bool, ?keep_tokens: bool) -> Node
|
128
|
+
|
129
|
+
# <!--
|
130
|
+
# rdoc-file=ast.rb
|
131
|
+
# - RubyVM::AbstractSyntaxTree.of(proc, keep_script_lines: false, error_tolerant: false, keep_tokens: false) -> RubyVM::AbstractSyntaxTree::Node
|
132
|
+
# - RubyVM::AbstractSyntaxTree.of(method, keep_script_lines: false, error_tolerant: false, keep_tokens: false) -> RubyVM::AbstractSyntaxTree::Node
|
133
|
+
# -->
|
134
|
+
# Returns AST nodes of the given *proc* or *method*.
|
135
|
+
#
|
136
|
+
# RubyVM::AbstractSyntaxTree.of(proc {1 + 2})
|
137
|
+
# # => #<RubyVM::AbstractSyntaxTree::Node:SCOPE@1:35-1:42>
|
138
|
+
#
|
139
|
+
# def hello
|
140
|
+
# puts "hello, world"
|
141
|
+
# end
|
142
|
+
#
|
143
|
+
# RubyVM::AbstractSyntaxTree.of(method(:hello))
|
144
|
+
# # => #<RubyVM::AbstractSyntaxTree::Node:SCOPE@1:0-3:3>
|
145
|
+
#
|
146
|
+
# See ::parse for explanation of keyword argument meaning and usage.
|
147
|
+
#
|
148
|
+
def self.of: (Proc | Method | UnboundMethod body, ?keep_script_lines: bool, ?error_tolerant: bool, ?keep_tokens: bool) -> Node?
|
149
|
+
|
150
|
+
# <!--
|
151
|
+
# rdoc-file=ast.rb
|
152
|
+
# - RubyVM::AbstractSyntaxTree.node_id_for_backtrace_location(backtrace_location) -> integer
|
153
|
+
# -->
|
154
|
+
# Returns the node id for the given backtrace location.
|
155
|
+
#
|
156
|
+
# begin
|
157
|
+
# raise
|
158
|
+
# rescue => e
|
159
|
+
# loc = e.backtrace_locations.first
|
160
|
+
# RubyVM::AbstractSyntaxTree.node_id_for_backtrace_location(loc)
|
161
|
+
# end # => 0
|
162
|
+
#
|
163
|
+
def self.node_id_for_backtrace_location: (Thread::Backtrace::Location backtrace_location) -> Integer
|
164
|
+
|
165
|
+
# <!-- rdoc-file=ast.rb -->
|
166
|
+
# RubyVM::AbstractSyntaxTree::Node instances are created by parse methods in
|
167
|
+
# RubyVM::AbstractSyntaxTree.
|
168
|
+
#
|
169
|
+
# This class is MRI specific.
|
170
|
+
#
|
171
|
+
class Node
|
172
|
+
# <!--
|
173
|
+
# rdoc-file=ast.rb
|
174
|
+
# - node.type -> symbol
|
175
|
+
# -->
|
176
|
+
# Returns the type of this node as a symbol.
|
177
|
+
#
|
178
|
+
# root = RubyVM::AbstractSyntaxTree.parse("x = 1 + 2")
|
179
|
+
# root.type # => :SCOPE
|
180
|
+
# lasgn = root.children[2]
|
181
|
+
# lasgn.type # => :LASGN
|
182
|
+
# call = lasgn.children[1]
|
183
|
+
# call.type # => :OPCALL
|
184
|
+
#
|
185
|
+
def type: () -> Symbol
|
186
|
+
|
187
|
+
# <!--
|
188
|
+
# rdoc-file=ast.rb
|
189
|
+
# - node.first_lineno -> integer
|
190
|
+
# -->
|
191
|
+
# The line number in the source code where this AST's text began.
|
192
|
+
#
|
193
|
+
def first_lineno: () -> Integer
|
194
|
+
|
195
|
+
# <!--
|
196
|
+
# rdoc-file=ast.rb
|
197
|
+
# - node.first_column -> integer
|
198
|
+
# -->
|
199
|
+
# The column number in the source code where this AST's text began.
|
200
|
+
#
|
201
|
+
def first_column: () -> Integer
|
202
|
+
|
203
|
+
# <!--
|
204
|
+
# rdoc-file=ast.rb
|
205
|
+
# - node.last_lineno -> integer
|
206
|
+
# -->
|
207
|
+
# The line number in the source code where this AST's text ended.
|
208
|
+
#
|
209
|
+
def last_lineno: () -> Integer
|
210
|
+
|
211
|
+
# <!--
|
212
|
+
# rdoc-file=ast.rb
|
213
|
+
# - node.last_column -> integer
|
214
|
+
# -->
|
215
|
+
# The column number in the source code where this AST's text ended.
|
216
|
+
#
|
217
|
+
def last_column: () -> Integer
|
218
|
+
|
219
|
+
# <!--
|
220
|
+
# rdoc-file=ast.rb
|
221
|
+
# - node.tokens -> array
|
222
|
+
# -->
|
223
|
+
# Returns tokens corresponding to the location of the node. Returns `nil` if
|
224
|
+
# `keep_tokens` is not enabled when #parse method is called.
|
225
|
+
#
|
226
|
+
# root = RubyVM::AbstractSyntaxTree.parse("x = 1 + 2", keep_tokens: true)
|
227
|
+
# root.tokens # => [[0, :tIDENTIFIER, "x", [1, 0, 1, 1]], [1, :tSP, " ", [1, 1, 1, 2]], ...]
|
228
|
+
# root.tokens.map{_1[2]}.join # => "x = 1 + 2"
|
229
|
+
#
|
230
|
+
# Token is an array of:
|
231
|
+
#
|
232
|
+
# * id
|
233
|
+
# * token type
|
234
|
+
# * source code text
|
235
|
+
# * location [ first_lineno, first_column, last_lineno, last_column ]
|
236
|
+
#
|
237
|
+
def tokens: () -> Array[[Integer, Symbol, String, [Integer, Integer, Integer, Integer]]]?
|
238
|
+
|
239
|
+
# <!--
|
240
|
+
# rdoc-file=ast.rb
|
241
|
+
# - node.all_tokens -> array
|
242
|
+
# -->
|
243
|
+
# Returns all tokens for the input script regardless the receiver node. Returns
|
244
|
+
# `nil` if `keep_tokens` is not enabled when #parse method is called.
|
245
|
+
#
|
246
|
+
# root = RubyVM::AbstractSyntaxTree.parse("x = 1 + 2", keep_tokens: true)
|
247
|
+
# root.all_tokens # => [[0, :tIDENTIFIER, "x", [1, 0, 1, 1]], [1, :tSP, " ", [1, 1, 1, 2]], ...]
|
248
|
+
# root.children[-1].all_tokens # => [[0, :tIDENTIFIER, "x", [1, 0, 1, 1]], [1, :tSP, " ", [1, 1, 1, 2]], ...]
|
249
|
+
#
|
250
|
+
def all_tokens: () -> Array[[Integer, Symbol, String, [Integer, Integer, Integer, Integer]]]?
|
251
|
+
|
252
|
+
# <!--
|
253
|
+
# rdoc-file=ast.rb
|
254
|
+
# - node.children -> array
|
255
|
+
# -->
|
256
|
+
# Returns AST nodes under this one. Each kind of node has different children,
|
257
|
+
# depending on what kind of node it is.
|
258
|
+
#
|
259
|
+
# The returned array may contain other nodes or `nil`.
|
260
|
+
#
|
261
|
+
def children: () -> Array[untyped]
|
262
|
+
end
|
263
|
+
end
|
@@ -40,12 +40,8 @@
|
|
40
40
|
#
|
41
41
|
# ## What's Here
|
42
42
|
# First, what's elsewhere. Class Set:
|
43
|
-
# * Inherits from [class
|
44
|
-
#
|
45
|
-
# l-What-27s+Here).
|
46
|
-
# * Includes [module
|
47
|
-
# which provides dozens of additional
|
48
|
-
# g/en/master/Enumerable.html#module-Enumerable-label-What-27s+Here),
|
43
|
+
# * Inherits from [class Object](rdoc-ref:Object@What-27s+Here).
|
44
|
+
# * Includes [module Enumerable](rdoc-ref:Enumerable@What-27s+Here),
|
49
45
|
# which provides dozens of additional methods.
|
50
46
|
#
|
51
47
|
# In particular, class Set does not have many methods of its own
|
@@ -63,126 +59,126 @@
|
|
63
59
|
# * [And more....](#class-Set-label-Other+Methods)
|
64
60
|
#
|
65
61
|
# ### Methods for Creating a Set
|
66
|
-
# * ::[]
|
62
|
+
# * ::[]:
|
67
63
|
# Returns a new set containing the given objects.
|
68
|
-
# * ::new
|
64
|
+
# * ::new:
|
69
65
|
# Returns a new set containing either the given objects
|
70
66
|
# (if no block given) or the return values from the called block
|
71
67
|
# (if a block given).
|
72
68
|
#
|
73
69
|
# ### Methods for Set Operations
|
74
|
-
# * [|](#method-i-7C) (aliased as #union and #+)
|
70
|
+
# * [|](#method-i-7C) (aliased as #union and #+):
|
75
71
|
# Returns a new set containing all elements from `self`
|
76
72
|
# and all elements from a given enumerable (no duplicates).
|
77
|
-
# * [&](#method-i-26) (aliased as #intersection)
|
73
|
+
# * [&](#method-i-26) (aliased as #intersection):
|
78
74
|
# Returns a new set containing all elements common to `self`
|
79
75
|
# and a given enumerable.
|
80
|
-
# * [-](#method-i-2D) (aliased as #difference)
|
76
|
+
# * [-](#method-i-2D) (aliased as #difference):
|
81
77
|
# Returns a copy of `self` with all elements
|
82
78
|
# in a given enumerable removed.
|
83
|
-
# * [\^](#method-i-5E)
|
79
|
+
# * [\^](#method-i-5E):
|
84
80
|
# Returns a new set containing all elements from `self`
|
85
81
|
# and a given enumerable except those common to both.
|
86
82
|
#
|
87
83
|
# ### Methods for Comparing
|
88
|
-
# * [<=>](#method-i-3C-3D-3E)
|
84
|
+
# * [<=>](#method-i-3C-3D-3E):
|
89
85
|
# Returns -1, 0, or 1 as `self` is less than, equal to,
|
90
86
|
# or greater than a given object.
|
91
|
-
# * [==](#method-i-3D-3D)
|
87
|
+
# * [==](#method-i-3D-3D):
|
92
88
|
# Returns whether `self` and a given enumerable are equal,
|
93
89
|
# as determined by Object#eql?.
|
94
|
-
# * #compare_by_identity
|
90
|
+
# * #compare_by_identity?:
|
95
91
|
# Returns whether the set considers only identity
|
96
92
|
# when comparing elements.
|
97
93
|
#
|
98
94
|
# ### Methods for Querying
|
99
|
-
# * #length (aliased as #size)
|
95
|
+
# * #length (aliased as #size):
|
100
96
|
# Returns the count of elements.
|
101
|
-
# * #empty
|
97
|
+
# * #empty?:
|
102
98
|
# Returns whether the set has no elements.
|
103
|
-
# * #include? (aliased as #member? and #===)
|
99
|
+
# * #include? (aliased as #member? and #===):
|
104
100
|
# Returns whether a given object is an element in the set.
|
105
|
-
# * #subset? (aliased as [<=](#method-i-3C-3D))
|
101
|
+
# * #subset? (aliased as [<=](#method-i-3C-3D)):
|
106
102
|
# Returns whether a given object is a subset of the set.
|
107
|
-
# * #proper_subset? (aliased as [<](#method-i-3C))
|
103
|
+
# * #proper_subset? (aliased as [<](#method-i-3C)):
|
108
104
|
# Returns whether a given enumerable is a proper subset of the set.
|
109
|
-
# * #superset? (aliased as [
|
105
|
+
# * #superset? (aliased as [>=](#method-i-3E-3D)]):
|
110
106
|
# Returns whether a given enumerable is a superset of the set.
|
111
|
-
# * #proper_superset? (aliased as [>](#method-i-3E))
|
107
|
+
# * #proper_superset? (aliased as [>](#method-i-3E)):
|
112
108
|
# Returns whether a given enumerable is a proper superset of the set.
|
113
|
-
# * #disjoint
|
109
|
+
# * #disjoint?:
|
114
110
|
# Returns `true` if the set and a given enumerable
|
115
111
|
# have no common elements, `false` otherwise.
|
116
|
-
# * #intersect
|
117
|
-
# Returns `true` if the set and a given enumerable
|
112
|
+
# * #intersect?:
|
113
|
+
# Returns `true` if the set and a given enumerable:
|
118
114
|
# have any common elements, `false` otherwise.
|
119
|
-
# * #compare_by_identity
|
115
|
+
# * #compare_by_identity?:
|
120
116
|
# Returns whether the set considers only identity
|
121
117
|
# when comparing elements.
|
122
118
|
#
|
123
119
|
# ### Methods for Assigning
|
124
|
-
# * #add (aliased as #<<)
|
120
|
+
# * #add (aliased as #<<):
|
125
121
|
# Adds a given object to the set; returns `self`.
|
126
|
-
# * #add
|
122
|
+
# * #add?:
|
127
123
|
# If the given object is not an element in the set,
|
128
124
|
# adds it and returns `self`; otherwise, returns `nil`.
|
129
|
-
# * #merge
|
125
|
+
# * #merge:
|
130
126
|
# Adds each given object to the set; returns `self`.
|
131
|
-
# * #replace
|
127
|
+
# * #replace:
|
132
128
|
# Replaces the contents of the set with the contents
|
133
129
|
# of a given enumerable.
|
134
130
|
#
|
135
131
|
# ### Methods for Deleting
|
136
|
-
# * #clear
|
132
|
+
# * #clear:
|
137
133
|
# Removes all elements in the set; returns `self`.
|
138
|
-
# * #delete
|
134
|
+
# * #delete:
|
139
135
|
# Removes a given object from the set; returns `self`.
|
140
|
-
# * #delete
|
136
|
+
# * #delete?:
|
141
137
|
# If the given object is an element in the set,
|
142
138
|
# removes it and returns `self`; otherwise, returns `nil`.
|
143
|
-
# * #subtract
|
139
|
+
# * #subtract:
|
144
140
|
# Removes each given object from the set; returns `self`.
|
145
141
|
# * #delete_if - Removes elements specified by a given block.
|
146
|
-
# * #select! (aliased as #filter!)
|
142
|
+
# * #select! (aliased as #filter!):
|
147
143
|
# Removes elements not specified by a given block.
|
148
|
-
# * #keep_if
|
144
|
+
# * #keep_if:
|
149
145
|
# Removes elements not specified by a given block.
|
150
146
|
# * #reject!
|
151
147
|
# Removes elements specified by a given block.
|
152
148
|
#
|
153
149
|
# ### Methods for Converting
|
154
|
-
# * #classify
|
150
|
+
# * #classify:
|
155
151
|
# Returns a hash that classifies the elements,
|
156
152
|
# as determined by the given block.
|
157
|
-
# * #collect! (aliased as #map!)
|
153
|
+
# * #collect! (aliased as #map!):
|
158
154
|
# Replaces each element with a block return-value.
|
159
|
-
# * #divide
|
155
|
+
# * #divide:
|
160
156
|
# Returns a hash that classifies the elements,
|
161
157
|
# as determined by the given block;
|
162
158
|
# differs from #classify in that the block may accept
|
163
159
|
# either one or two arguments.
|
164
|
-
# * #flatten
|
160
|
+
# * #flatten:
|
165
161
|
# Returns a new set that is a recursive flattening of `self`.
|
166
|
-
# #flatten
|
162
|
+
# #flatten!:
|
167
163
|
# Replaces each nested set in `self` with the elements from that set.
|
168
|
-
# * #inspect (aliased as #to_s)
|
164
|
+
# * #inspect (aliased as #to_s):
|
169
165
|
# Returns a string displaying the elements.
|
170
|
-
# * #join
|
166
|
+
# * #join:
|
171
167
|
# Returns a string containing all elements, converted to strings
|
172
168
|
# as needed, and joined by the given record separator.
|
173
|
-
# * #to_a
|
169
|
+
# * #to_a:
|
174
170
|
# Returns an array containing all set elements.
|
175
|
-
# * #to_set
|
171
|
+
# * #to_set:
|
176
172
|
# Returns `self` if given no arguments and no block;
|
177
173
|
# with a block given, returns a new set consisting of block
|
178
174
|
# return values.
|
179
175
|
#
|
180
176
|
# ### Methods for Iterating
|
181
|
-
# * #each
|
177
|
+
# * #each:
|
182
178
|
# Calls the block with each successive element; returns `self`.
|
183
179
|
#
|
184
180
|
# ### Other Methods
|
185
|
-
# * #reset
|
181
|
+
# * #reset:
|
186
182
|
# Resets the internal state; useful if an object
|
187
183
|
# has been modified while an element in the set.
|
188
184
|
#
|