steep 0.16.0 → 0.16.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitmodules +0 -3
- data/CHANGELOG.md +6 -0
- data/Rakefile +0 -13
- data/bin/setup +0 -2
- data/bin/smoke_runner.rb +0 -1
- data/exe/steep +0 -1
- data/lib/steep/project/file.rb +1 -1
- data/lib/steep/project/hover_content.rb +1 -1
- data/lib/steep/server/code_worker.rb +1 -1
- data/lib/steep/server/signature_worker.rb +4 -4
- data/lib/steep/type_construction.rb +10 -16
- data/lib/steep/type_inference/constant_env.rb +2 -10
- data/lib/steep/type_inference/context.rb +1 -0
- data/lib/steep/version.rb +1 -1
- data/steep.gemspec +1 -5
- metadata +17 -135
- data/exe/rbs +0 -3
- data/vendor/ruby-signature/.github/workflows/ruby.yml +0 -27
- data/vendor/ruby-signature/.gitignore +0 -12
- data/vendor/ruby-signature/.rubocop.yml +0 -15
- data/vendor/ruby-signature/BSDL +0 -22
- data/vendor/ruby-signature/COPYING +0 -56
- data/vendor/ruby-signature/Gemfile +0 -6
- data/vendor/ruby-signature/README.md +0 -93
- data/vendor/ruby-signature/Rakefile +0 -142
- data/vendor/ruby-signature/bin/annotate-with-rdoc +0 -157
- data/vendor/ruby-signature/bin/console +0 -14
- data/vendor/ruby-signature/bin/query-rdoc +0 -103
- data/vendor/ruby-signature/bin/setup +0 -10
- data/vendor/ruby-signature/bin/sort +0 -89
- data/vendor/ruby-signature/bin/test_runner.rb +0 -16
- data/vendor/ruby-signature/docs/CONTRIBUTING.md +0 -97
- data/vendor/ruby-signature/docs/sigs.md +0 -148
- data/vendor/ruby-signature/docs/stdlib.md +0 -152
- data/vendor/ruby-signature/docs/syntax.md +0 -528
- data/vendor/ruby-signature/exe/rbs +0 -7
- data/vendor/ruby-signature/lib/rbs.rb +0 -64
- data/vendor/ruby-signature/lib/rbs/ast/annotation.rb +0 -27
- data/vendor/ruby-signature/lib/rbs/ast/comment.rb +0 -27
- data/vendor/ruby-signature/lib/rbs/ast/declarations.rb +0 -395
- data/vendor/ruby-signature/lib/rbs/ast/members.rb +0 -362
- data/vendor/ruby-signature/lib/rbs/buffer.rb +0 -50
- data/vendor/ruby-signature/lib/rbs/builtin_names.rb +0 -55
- data/vendor/ruby-signature/lib/rbs/cli.rb +0 -558
- data/vendor/ruby-signature/lib/rbs/constant.rb +0 -26
- data/vendor/ruby-signature/lib/rbs/constant_table.rb +0 -150
- data/vendor/ruby-signature/lib/rbs/definition.rb +0 -170
- data/vendor/ruby-signature/lib/rbs/definition_builder.rb +0 -919
- data/vendor/ruby-signature/lib/rbs/environment.rb +0 -281
- data/vendor/ruby-signature/lib/rbs/environment_loader.rb +0 -136
- data/vendor/ruby-signature/lib/rbs/environment_walker.rb +0 -124
- data/vendor/ruby-signature/lib/rbs/errors.rb +0 -187
- data/vendor/ruby-signature/lib/rbs/location.rb +0 -102
- data/vendor/ruby-signature/lib/rbs/method_type.rb +0 -123
- data/vendor/ruby-signature/lib/rbs/namespace.rb +0 -91
- data/vendor/ruby-signature/lib/rbs/parser.y +0 -1344
- data/vendor/ruby-signature/lib/rbs/prototype/rb.rb +0 -553
- data/vendor/ruby-signature/lib/rbs/prototype/rbi.rb +0 -587
- data/vendor/ruby-signature/lib/rbs/prototype/runtime.rb +0 -381
- data/vendor/ruby-signature/lib/rbs/substitution.rb +0 -46
- data/vendor/ruby-signature/lib/rbs/test.rb +0 -26
- data/vendor/ruby-signature/lib/rbs/test/errors.rb +0 -61
- data/vendor/ruby-signature/lib/rbs/test/hook.rb +0 -294
- data/vendor/ruby-signature/lib/rbs/test/setup.rb +0 -58
- data/vendor/ruby-signature/lib/rbs/test/spy.rb +0 -325
- data/vendor/ruby-signature/lib/rbs/test/test_helper.rb +0 -183
- data/vendor/ruby-signature/lib/rbs/test/type_check.rb +0 -254
- data/vendor/ruby-signature/lib/rbs/type_name.rb +0 -70
- data/vendor/ruby-signature/lib/rbs/types.rb +0 -936
- data/vendor/ruby-signature/lib/rbs/variance_calculator.rb +0 -138
- data/vendor/ruby-signature/lib/rbs/vendorer.rb +0 -47
- data/vendor/ruby-signature/lib/rbs/version.rb +0 -3
- data/vendor/ruby-signature/lib/rbs/writer.rb +0 -269
- data/vendor/ruby-signature/lib/ruby/signature.rb +0 -7
- data/vendor/ruby-signature/rbs.gemspec +0 -46
- data/vendor/ruby-signature/stdlib/abbrev/abbrev.rbs +0 -60
- data/vendor/ruby-signature/stdlib/base64/base64.rbs +0 -71
- data/vendor/ruby-signature/stdlib/benchmark/benchmark.rbs +0 -372
- data/vendor/ruby-signature/stdlib/builtin/array.rbs +0 -1997
- data/vendor/ruby-signature/stdlib/builtin/basic_object.rbs +0 -280
- data/vendor/ruby-signature/stdlib/builtin/binding.rbs +0 -177
- data/vendor/ruby-signature/stdlib/builtin/builtin.rbs +0 -45
- data/vendor/ruby-signature/stdlib/builtin/class.rbs +0 -145
- data/vendor/ruby-signature/stdlib/builtin/comparable.rbs +0 -116
- data/vendor/ruby-signature/stdlib/builtin/complex.rbs +0 -400
- data/vendor/ruby-signature/stdlib/builtin/constants.rbs +0 -37
- data/vendor/ruby-signature/stdlib/builtin/data.rbs +0 -5
- data/vendor/ruby-signature/stdlib/builtin/deprecated.rbs +0 -2
- data/vendor/ruby-signature/stdlib/builtin/dir.rbs +0 -413
- data/vendor/ruby-signature/stdlib/builtin/encoding.rbs +0 -607
- data/vendor/ruby-signature/stdlib/builtin/enumerable.rbs +0 -404
- data/vendor/ruby-signature/stdlib/builtin/enumerator.rbs +0 -260
- data/vendor/ruby-signature/stdlib/builtin/errno.rbs +0 -781
- data/vendor/ruby-signature/stdlib/builtin/errors.rbs +0 -582
- data/vendor/ruby-signature/stdlib/builtin/exception.rbs +0 -194
- data/vendor/ruby-signature/stdlib/builtin/false_class.rbs +0 -40
- data/vendor/ruby-signature/stdlib/builtin/fiber.rbs +0 -68
- data/vendor/ruby-signature/stdlib/builtin/fiber_error.rbs +0 -12
- data/vendor/ruby-signature/stdlib/builtin/file.rbs +0 -1076
- data/vendor/ruby-signature/stdlib/builtin/file_test.rbs +0 -59
- data/vendor/ruby-signature/stdlib/builtin/float.rbs +0 -696
- data/vendor/ruby-signature/stdlib/builtin/gc.rbs +0 -243
- data/vendor/ruby-signature/stdlib/builtin/hash.rbs +0 -1029
- data/vendor/ruby-signature/stdlib/builtin/integer.rbs +0 -707
- data/vendor/ruby-signature/stdlib/builtin/io.rbs +0 -683
- data/vendor/ruby-signature/stdlib/builtin/kernel.rbs +0 -576
- data/vendor/ruby-signature/stdlib/builtin/marshal.rbs +0 -161
- data/vendor/ruby-signature/stdlib/builtin/match_data.rbs +0 -271
- data/vendor/ruby-signature/stdlib/builtin/math.rbs +0 -369
- data/vendor/ruby-signature/stdlib/builtin/method.rbs +0 -185
- data/vendor/ruby-signature/stdlib/builtin/module.rbs +0 -1104
- data/vendor/ruby-signature/stdlib/builtin/nil_class.rbs +0 -82
- data/vendor/ruby-signature/stdlib/builtin/numeric.rbs +0 -409
- data/vendor/ruby-signature/stdlib/builtin/object.rbs +0 -824
- data/vendor/ruby-signature/stdlib/builtin/proc.rbs +0 -429
- data/vendor/ruby-signature/stdlib/builtin/process.rbs +0 -1227
- data/vendor/ruby-signature/stdlib/builtin/random.rbs +0 -267
- data/vendor/ruby-signature/stdlib/builtin/range.rbs +0 -226
- data/vendor/ruby-signature/stdlib/builtin/rational.rbs +0 -424
- data/vendor/ruby-signature/stdlib/builtin/rb_config.rbs +0 -57
- data/vendor/ruby-signature/stdlib/builtin/regexp.rbs +0 -1083
- data/vendor/ruby-signature/stdlib/builtin/ruby_vm.rbs +0 -14
- data/vendor/ruby-signature/stdlib/builtin/signal.rbs +0 -55
- data/vendor/ruby-signature/stdlib/builtin/string.rbs +0 -1901
- data/vendor/ruby-signature/stdlib/builtin/string_io.rbs +0 -284
- data/vendor/ruby-signature/stdlib/builtin/struct.rbs +0 -40
- data/vendor/ruby-signature/stdlib/builtin/symbol.rbs +0 -228
- data/vendor/ruby-signature/stdlib/builtin/thread.rbs +0 -1108
- data/vendor/ruby-signature/stdlib/builtin/thread_group.rbs +0 -23
- data/vendor/ruby-signature/stdlib/builtin/time.rbs +0 -1047
- data/vendor/ruby-signature/stdlib/builtin/trace_point.rbs +0 -290
- data/vendor/ruby-signature/stdlib/builtin/true_class.rbs +0 -46
- data/vendor/ruby-signature/stdlib/builtin/unbound_method.rbs +0 -153
- data/vendor/ruby-signature/stdlib/builtin/warning.rbs +0 -17
- data/vendor/ruby-signature/stdlib/coverage/coverage.rbs +0 -62
- data/vendor/ruby-signature/stdlib/csv/csv.rbs +0 -773
- data/vendor/ruby-signature/stdlib/erb/erb.rbs +0 -392
- data/vendor/ruby-signature/stdlib/find/find.rbs +0 -40
- data/vendor/ruby-signature/stdlib/ipaddr/ipaddr.rbs +0 -247
- data/vendor/ruby-signature/stdlib/json/json.rbs +0 -335
- data/vendor/ruby-signature/stdlib/pathname/pathname.rbs +0 -1093
- data/vendor/ruby-signature/stdlib/prime/integer-extension.rbs +0 -23
- data/vendor/ruby-signature/stdlib/prime/prime.rbs +0 -188
- data/vendor/ruby-signature/stdlib/securerandom/securerandom.rbs +0 -9
- data/vendor/ruby-signature/stdlib/set/set.rbs +0 -301
- data/vendor/ruby-signature/stdlib/tmpdir/tmpdir.rbs +0 -53
@@ -1,335 +0,0 @@
|
|
1
|
-
interface _ToJson
|
2
|
-
def to_json: (?JSON::State state) -> String
|
3
|
-
end
|
4
|
-
|
5
|
-
interface _JsonToWritableIO
|
6
|
-
def to_io: () -> _JsonWrite
|
7
|
-
end
|
8
|
-
|
9
|
-
interface _JsonWrite
|
10
|
-
def write: (String json) -> void
|
11
|
-
end
|
12
|
-
|
13
|
-
interface _JsonReadableIO
|
14
|
-
def to_io: () -> _JsonRead
|
15
|
-
end
|
16
|
-
|
17
|
-
interface _JsonRead
|
18
|
-
def read: () -> string
|
19
|
-
end
|
20
|
-
|
21
|
-
type json_options = Hash[Symbol, untyped]
|
22
|
-
|
23
|
-
class JSON::State
|
24
|
-
end
|
25
|
-
|
26
|
-
# This module holds all the modules/classes that implement JSON's functionality
|
27
|
-
# as C extensions.
|
28
|
-
#
|
29
|
-
module JSON::Ext
|
30
|
-
end
|
31
|
-
|
32
|
-
# This is the JSON generator implemented as a C extension. It can be configured
|
33
|
-
# to be used by setting
|
34
|
-
#
|
35
|
-
# JSON.generator = JSON::Ext::Generator
|
36
|
-
#
|
37
|
-
# with the method generator= in JSON.
|
38
|
-
#
|
39
|
-
module JSON::Ext::Generator
|
40
|
-
end
|
41
|
-
|
42
|
-
class JSON::Ext::Generator::State
|
43
|
-
end
|
44
|
-
|
45
|
-
module JSON::Pure
|
46
|
-
end
|
47
|
-
|
48
|
-
module JSON::Pure::Generator
|
49
|
-
end
|
50
|
-
|
51
|
-
class JSON::Pure::Generator::State
|
52
|
-
end
|
53
|
-
|
54
|
-
type json_generator = singleton(::JSON::Ext::Generator) | singleton(::JSON::Pure::Generator)
|
55
|
-
type json_parser = singleton(::JSON::Ext::Parser) | singleton(::JSON::Pure::Parser)
|
56
|
-
type json_state = singleton(JSON::Ext::Generator::State) | singleton(JSON::Pure::Generator::State)
|
57
|
-
|
58
|
-
# # JavaScript Object Notation (JSON)
|
59
|
-
#
|
60
|
-
# JSON is a lightweight data-interchange format. It is easy for us humans to
|
61
|
-
# read and write. Plus, equally simple for machines to generate or parse. JSON
|
62
|
-
# is completely language agnostic, making it the ideal interchange format.
|
63
|
-
#
|
64
|
-
# Built on two universally available structures:
|
65
|
-
# 1. A collection of name/value pairs. Often referred to as an _object_, hash table, record, struct, keyed list, or associative array.
|
66
|
-
# 2. An ordered list of values. More commonly called an _array_, vector, sequence or list.
|
67
|
-
#
|
68
|
-
# To read more about JSON visit: http://json.org
|
69
|
-
#
|
70
|
-
# ## Parsing JSON
|
71
|
-
#
|
72
|
-
# To parse a JSON string received by another application or generated within
|
73
|
-
# your existing application:
|
74
|
-
#
|
75
|
-
# require 'json'
|
76
|
-
#
|
77
|
-
# my_hash = JSON.parse('{"hello": "goodbye"}')
|
78
|
-
# puts my_hash["hello"] => "goodbye"
|
79
|
-
#
|
80
|
-
# Notice the extra quotes `''` around the hash notation. Ruby expects the
|
81
|
-
# argument to be a string and can't convert objects like a hash or array.
|
82
|
-
#
|
83
|
-
# Ruby converts your string into a hash
|
84
|
-
#
|
85
|
-
# ## Generating JSON
|
86
|
-
#
|
87
|
-
# Creating a JSON string for communication or serialization is just as simple.
|
88
|
-
#
|
89
|
-
# require 'json'
|
90
|
-
#
|
91
|
-
# my_hash = {:hello => "goodbye"}
|
92
|
-
# puts JSON.generate(my_hash) => "{\"hello\":\"goodbye\"}"
|
93
|
-
#
|
94
|
-
# Or an alternative way:
|
95
|
-
#
|
96
|
-
# require 'json'
|
97
|
-
# puts {:hello => "goodbye"}.to_json => "{\"hello\":\"goodbye\"}"
|
98
|
-
#
|
99
|
-
# `JSON.generate` only allows objects or arrays to be converted to JSON syntax.
|
100
|
-
# `to_json`, however, accepts many Ruby classes even though it acts only as a
|
101
|
-
# method for serialization:
|
102
|
-
#
|
103
|
-
# require 'json'
|
104
|
-
#
|
105
|
-
# 1.to_json => "1"
|
106
|
-
#
|
107
|
-
module JSON
|
108
|
-
# If *object* is string-like, parse the string and return the parsed result as a
|
109
|
-
# Ruby data structure. Otherwise generate a JSON text from the Ruby data
|
110
|
-
# structure object and return it.
|
111
|
-
#
|
112
|
-
# The *opts* argument is passed through to generate/parse respectively. See
|
113
|
-
# generate and parse for their documentation.
|
114
|
-
#
|
115
|
-
def self.[]: (untyped object, ?json_options opts) -> untyped
|
116
|
-
|
117
|
-
# This is create identifier, which is used to decide if the *json_create* hook
|
118
|
-
# of a class should be called. It defaults to 'json_class'.
|
119
|
-
#
|
120
|
-
def self.create_id: () -> _ToS
|
121
|
-
|
122
|
-
def self.create_id=: (_ToS create_id) -> _ToS
|
123
|
-
|
124
|
-
def self.deep_const_get: (_ToS path) -> untyped
|
125
|
-
# Dumps *obj* as a JSON string, i.e. calls generate on the object and returns
|
126
|
-
# the result.
|
127
|
-
#
|
128
|
-
# If anIO (an IO-like object or an object that responds to the write method) was
|
129
|
-
# given, the resulting JSON is written to it.
|
130
|
-
#
|
131
|
-
# If the number of nested arrays or objects exceeds *limit*, an ArgumentError
|
132
|
-
# exception is raised. This argument is similar (but not exactly the same!) to
|
133
|
-
# the *limit* argument in Marshal.dump.
|
134
|
-
#
|
135
|
-
# The default options for the generator can be changed via the
|
136
|
-
# dump_default_options method.
|
137
|
-
#
|
138
|
-
# This method is part of the implementation of the load/dump interface of
|
139
|
-
# Marshal and YAML.
|
140
|
-
#
|
141
|
-
def self?.dump: (_ToJson obj, ?Integer limit) -> String
|
142
|
-
| (_ToJson obj, _JsonToWritableIO anIO) -> _JsonWrite
|
143
|
-
| (_ToJson obj, _JsonWrite anIO, ?Integer limit) -> _JsonWrite
|
144
|
-
|
145
|
-
# The global default options for the JSON.dump method:
|
146
|
-
# :max_nesting: false
|
147
|
-
# :allow_nan: true
|
148
|
-
# :allow_blank: true
|
149
|
-
#
|
150
|
-
def self.dump_default_options: () -> json_options
|
151
|
-
|
152
|
-
def self.dump_default_options=: (json_options) -> json_options
|
153
|
-
|
154
|
-
# Generate a JSON document from the Ruby data structure *obj* and return it.
|
155
|
-
# This method disables the checks for circles in Ruby objects.
|
156
|
-
#
|
157
|
-
# **WARNING**: Be careful not to pass any Ruby data structures with circles as
|
158
|
-
# *obj* argument because this will cause JSON to go into an infinite loop.
|
159
|
-
#
|
160
|
-
def self?.fast_generate: (_ToJson obj, ?json_options opts) -> String
|
161
|
-
|
162
|
-
alias self.fast_unparse self.fast_generate
|
163
|
-
alias fast_unparse fast_generate
|
164
|
-
|
165
|
-
# Generate a JSON document from the Ruby data structure *obj* and return it.
|
166
|
-
# *state* is * a JSON::State object,
|
167
|
-
# * or a Hash like object (responding to to_hash),
|
168
|
-
# * an object convertible into a hash by a to_h method,
|
169
|
-
#
|
170
|
-
# that is used as or to configure a State object.
|
171
|
-
#
|
172
|
-
# It defaults to a state object, that creates the shortest possible JSON text in
|
173
|
-
# one line, checks for circular data structures and doesn't allow NaN, Infinity,
|
174
|
-
# and -Infinity.
|
175
|
-
#
|
176
|
-
# A *state* hash can have the following keys:
|
177
|
-
# * **indent**: a string used to indent levels (default: ''),
|
178
|
-
# * **space**: a string that is put after, a : or , delimiter (default: ''),
|
179
|
-
# * **space_before**: a string that is put before a : pair delimiter (default:
|
180
|
-
# ''),
|
181
|
-
# * **object_nl**: a string that is put at the end of a JSON object (default:
|
182
|
-
# ''),
|
183
|
-
# * **array_nl**: a string that is put at the end of a JSON array (default:
|
184
|
-
# ''),
|
185
|
-
# * **allow_nan**: true if NaN, Infinity, and -Infinity should be generated,
|
186
|
-
# otherwise an exception is thrown if these values are encountered. This
|
187
|
-
# options defaults to false.
|
188
|
-
# * **max_nesting**: The maximum depth of nesting allowed in the data
|
189
|
-
# structures from which JSON is to be generated. Disable depth checking with
|
190
|
-
# :max_nesting => false, it defaults to 100.
|
191
|
-
#
|
192
|
-
#
|
193
|
-
# See also the fast_generate for the fastest creation method with the least
|
194
|
-
# amount of sanity checks, and the pretty_generate method for some defaults for
|
195
|
-
# pretty output.
|
196
|
-
#
|
197
|
-
def self?.generate: (_ToJson obj, ?json_options opts) -> String
|
198
|
-
|
199
|
-
# Returns the JSON generator module that is used by JSON. This is either
|
200
|
-
# JSON::Ext::Generator or JSON::Pure::Generator.
|
201
|
-
#
|
202
|
-
def self.generator: () -> json_generator
|
203
|
-
|
204
|
-
def self.generator=: (json_generator generator) -> void
|
205
|
-
|
206
|
-
# Encodes string using Ruby's *String.encode*
|
207
|
-
#
|
208
|
-
def self.iconv: (encoding to, encoding from, String string) -> String
|
209
|
-
|
210
|
-
# Load a ruby data structure from a JSON *source* and return it. A source can
|
211
|
-
# either be a string-like object, an IO-like object, or an object responding to
|
212
|
-
# the read method. If *proc* was given, it will be called with any nested Ruby
|
213
|
-
# object as an argument recursively in depth first order. To modify the default
|
214
|
-
# options pass in the optional *options* argument as well.
|
215
|
-
#
|
216
|
-
# BEWARE: This method is meant to serialise data from trusted user input, like
|
217
|
-
# from your own database server or clients under your control, it could be
|
218
|
-
# dangerous to allow untrusted users to pass JSON sources into it. The default
|
219
|
-
# options for the parser can be changed via the load_default_options method.
|
220
|
-
#
|
221
|
-
# This method is part of the implementation of the load/dump interface of
|
222
|
-
# Marshal and YAML.
|
223
|
-
#
|
224
|
-
def self?.load: (string | _JsonReadableIO | _JsonRead source, ?Proc proc, ?json_options options) -> untyped
|
225
|
-
|
226
|
-
# The global default options for the JSON.load method:
|
227
|
-
# :max_nesting: false
|
228
|
-
# :allow_nan: true
|
229
|
-
# :allow_blank: true
|
230
|
-
#
|
231
|
-
def self.load_default_options: () -> json_options
|
232
|
-
|
233
|
-
def self.load_default_options=: (json_options) -> json_options
|
234
|
-
|
235
|
-
# Parse the JSON document *source* into a Ruby data structure and return it.
|
236
|
-
#
|
237
|
-
# *opts* can have the following keys:
|
238
|
-
# * **max_nesting**: The maximum depth of nesting allowed in the parsed data
|
239
|
-
# structures. Disable depth checking with :max_nesting => false. It defaults
|
240
|
-
# to 100.
|
241
|
-
# * **allow_nan**: If set to true, allow NaN, Infinity and -Infinity in
|
242
|
-
# defiance of RFC 7159 to be parsed by the Parser. This option defaults to
|
243
|
-
# false.
|
244
|
-
# * **symbolize_names**: If set to true, returns symbols for the names (keys)
|
245
|
-
# in a JSON object. Otherwise strings are returned. Strings are the default.
|
246
|
-
# * **create_additions**: If set to false, the Parser doesn't create additions
|
247
|
-
# even if a matching class and create_id was found. This option defaults to
|
248
|
-
# false.
|
249
|
-
# * **object_class**: Defaults to Hash
|
250
|
-
# * **array_class**: Defaults to Array
|
251
|
-
#
|
252
|
-
#
|
253
|
-
def self?.parse: (string source, ?json_options opts) -> untyped
|
254
|
-
|
255
|
-
# Parse the JSON document *source* into a Ruby data structure and return it. The
|
256
|
-
# bang version of the parse method defaults to the more dangerous values for the
|
257
|
-
# *opts* hash, so be sure only to parse trusted *source* documents.
|
258
|
-
#
|
259
|
-
# *opts* can have the following keys:
|
260
|
-
# * **max_nesting**: The maximum depth of nesting allowed in the parsed data
|
261
|
-
# structures. Enable depth checking with :max_nesting => anInteger. The
|
262
|
-
# parse! methods defaults to not doing max depth checking: This can be
|
263
|
-
# dangerous if someone wants to fill up your stack.
|
264
|
-
# * **allow_nan**: If set to true, allow NaN, Infinity, and -Infinity in
|
265
|
-
# defiance of RFC 7159 to be parsed by the Parser. This option defaults to
|
266
|
-
# true.
|
267
|
-
# * **create_additions**: If set to false, the Parser doesn't create additions
|
268
|
-
# even if a matching class and create_id was found. This option defaults to
|
269
|
-
# false.
|
270
|
-
#
|
271
|
-
#
|
272
|
-
def self?.parse!: (string source, ?json_options opts) -> untyped
|
273
|
-
|
274
|
-
# Returns the JSON parser class that is used by JSON. This is either
|
275
|
-
# JSON::Ext::Parser or JSON::Pure::Parser.
|
276
|
-
#
|
277
|
-
def self.parser: () -> json_parser
|
278
|
-
|
279
|
-
def self.parser=: (json_parser parser) -> void
|
280
|
-
|
281
|
-
# Generate a JSON document from the Ruby data structure *obj* and return it. The
|
282
|
-
# returned document is a prettier form of the document returned by #unparse.
|
283
|
-
#
|
284
|
-
# The *opts* argument can be used to configure the generator. See the generate
|
285
|
-
# method for a more detailed explanation.
|
286
|
-
#
|
287
|
-
def self?.pretty_generate: (_ToJson obj, ?json_options opts) -> untyped
|
288
|
-
|
289
|
-
alias self.pretty_unparse self.pretty_generate
|
290
|
-
alias pretty_unparse pretty_generate
|
291
|
-
|
292
|
-
# Recursively calls passed *Proc* if the parsed data structure is an *Array* or
|
293
|
-
# *Hash*
|
294
|
-
#
|
295
|
-
def self?.recurse_proc: (untyped result) { (*untyped) -> void } -> void
|
296
|
-
|
297
|
-
alias self.restore self.load
|
298
|
-
alias restore load
|
299
|
-
|
300
|
-
# Returns the JSON generator state class that is used by JSON. This is either
|
301
|
-
# JSON::Ext::Generator::State or JSON::Pure::Generator::State.
|
302
|
-
#
|
303
|
-
def self.state: () -> json_state
|
304
|
-
|
305
|
-
def self.state=: (json_state) -> json_state
|
306
|
-
|
307
|
-
alias self.unparse self.generate
|
308
|
-
alias unparse generate
|
309
|
-
end
|
310
|
-
|
311
|
-
JSON::FAST_STATE_PROTOTYPE: json_state
|
312
|
-
|
313
|
-
JSON::Infinity: Float
|
314
|
-
|
315
|
-
JSON::JSON_LOADED: bool
|
316
|
-
|
317
|
-
JSON::MinusInfinity: Float
|
318
|
-
|
319
|
-
JSON::NaN: Float
|
320
|
-
|
321
|
-
JSON::PRETTY_STATE_PROTOTYPE: json_state
|
322
|
-
|
323
|
-
JSON::SAFE_STATE_PROTOTYPE: json_state
|
324
|
-
|
325
|
-
# JSON version
|
326
|
-
#
|
327
|
-
JSON::VERSION: String
|
328
|
-
|
329
|
-
JSON::VERSION_ARRAY: Array
|
330
|
-
|
331
|
-
JSON::VERSION_BUILD: Integer
|
332
|
-
|
333
|
-
JSON::VERSION_MAJOR: Integer
|
334
|
-
|
335
|
-
JSON::VERSION_MINOR: Integer
|
@@ -1,1093 +0,0 @@
|
|
1
|
-
# Pathname represents the name of a file or directory on the filesystem, but not
|
2
|
-
# the file itself.
|
3
|
-
#
|
4
|
-
# The pathname depends on the Operating System: Unix, Windows, etc. This library
|
5
|
-
# works with pathnames of local OS, however non-Unix pathnames are supported
|
6
|
-
# experimentally.
|
7
|
-
#
|
8
|
-
# A Pathname can be relative or absolute. It's not until you try to reference
|
9
|
-
# the file that it even matters whether the file exists or not.
|
10
|
-
#
|
11
|
-
# Pathname is immutable. It has no method for destructive update.
|
12
|
-
#
|
13
|
-
# The goal of this class is to manipulate file path information in a neater way
|
14
|
-
# than standard Ruby provides. The examples below demonstrate the difference.
|
15
|
-
#
|
16
|
-
# **All** functionality from File, FileTest, and some from Dir and FileUtils is
|
17
|
-
# included, in an unsurprising way. It is essentially a facade for all of
|
18
|
-
# these, and more.
|
19
|
-
#
|
20
|
-
# ## Examples
|
21
|
-
#
|
22
|
-
# ### Example 1: Using Pathname
|
23
|
-
#
|
24
|
-
# require 'pathname'
|
25
|
-
# pn = Pathname.new("/usr/bin/ruby")
|
26
|
-
# size = pn.size # 27662
|
27
|
-
# isdir = pn.directory? # false
|
28
|
-
# dir = pn.dirname # Pathname:/usr/bin
|
29
|
-
# base = pn.basename # Pathname:ruby
|
30
|
-
# dir, base = pn.split # [Pathname:/usr/bin, Pathname:ruby]
|
31
|
-
# data = pn.read
|
32
|
-
# pn.open { |f| _ }
|
33
|
-
# pn.each_line { |line| _ }
|
34
|
-
#
|
35
|
-
# ### Example 2: Using standard Ruby
|
36
|
-
#
|
37
|
-
# pn = "/usr/bin/ruby"
|
38
|
-
# size = File.size(pn) # 27662
|
39
|
-
# isdir = File.directory?(pn) # false
|
40
|
-
# dir = File.dirname(pn) # "/usr/bin"
|
41
|
-
# base = File.basename(pn) # "ruby"
|
42
|
-
# dir, base = File.split(pn) # ["/usr/bin", "ruby"]
|
43
|
-
# data = File.read(pn)
|
44
|
-
# File.open(pn) { |f| _ }
|
45
|
-
# File.foreach(pn) { |line| _ }
|
46
|
-
#
|
47
|
-
# ### Example 3: Special features
|
48
|
-
#
|
49
|
-
# p1 = Pathname.new("/usr/lib") # Pathname:/usr/lib
|
50
|
-
# p2 = p1 + "ruby/1.8" # Pathname:/usr/lib/ruby/1.8
|
51
|
-
# p3 = p1.parent # Pathname:/usr
|
52
|
-
# p4 = p2.relative_path_from(p3) # Pathname:lib/ruby/1.8
|
53
|
-
# pwd = Pathname.pwd # Pathname:/home/gavin
|
54
|
-
# pwd.absolute? # true
|
55
|
-
# p5 = Pathname.new "." # Pathname:.
|
56
|
-
# p5 = p5 + "music/../articles" # Pathname:music/../articles
|
57
|
-
# p5.cleanpath # Pathname:articles
|
58
|
-
# p5.realpath # Pathname:/home/gavin/articles
|
59
|
-
# p5.children # [Pathname:/home/gavin/articles/linux, ...]
|
60
|
-
#
|
61
|
-
# ## Breakdown of functionality
|
62
|
-
#
|
63
|
-
# ### Core methods
|
64
|
-
#
|
65
|
-
# These methods are effectively manipulating a String, because that's all a path
|
66
|
-
# is. None of these access the file system except for #mountpoint?, #children,
|
67
|
-
# #each_child, #realdirpath and #realpath.
|
68
|
-
#
|
69
|
-
# * +
|
70
|
-
# * #join
|
71
|
-
# * #parent
|
72
|
-
# * #root?
|
73
|
-
# * #absolute?
|
74
|
-
# * #relative?
|
75
|
-
# * #relative_path_from
|
76
|
-
# * #each_filename
|
77
|
-
# * #cleanpath
|
78
|
-
# * #realpath
|
79
|
-
# * #realdirpath
|
80
|
-
# * #children
|
81
|
-
# * #each_child
|
82
|
-
# * #mountpoint?
|
83
|
-
#
|
84
|
-
#
|
85
|
-
# ### File status predicate methods
|
86
|
-
#
|
87
|
-
# These methods are a facade for FileTest:
|
88
|
-
# * #blockdev?
|
89
|
-
# * #chardev?
|
90
|
-
# * #directory?
|
91
|
-
# * #executable?
|
92
|
-
# * #executable_real?
|
93
|
-
# * #exist?
|
94
|
-
# * #file?
|
95
|
-
# * #grpowned?
|
96
|
-
# * #owned?
|
97
|
-
# * #pipe?
|
98
|
-
# * #readable?
|
99
|
-
# * #world_readable?
|
100
|
-
# * #readable_real?
|
101
|
-
# * #setgid?
|
102
|
-
# * #setuid?
|
103
|
-
# * #size
|
104
|
-
# * #size?
|
105
|
-
# * #socket?
|
106
|
-
# * #sticky?
|
107
|
-
# * #symlink?
|
108
|
-
# * #writable?
|
109
|
-
# * #world_writable?
|
110
|
-
# * #writable_real?
|
111
|
-
# * #zero?
|
112
|
-
#
|
113
|
-
#
|
114
|
-
# ### File property and manipulation methods
|
115
|
-
#
|
116
|
-
# These methods are a facade for File:
|
117
|
-
# * #atime
|
118
|
-
# * #birthtime
|
119
|
-
# * #ctime
|
120
|
-
# * #mtime
|
121
|
-
# * #chmod(mode)
|
122
|
-
# * #lchmod(mode)
|
123
|
-
# * #chown(owner, group)
|
124
|
-
# * #lchown(owner, group)
|
125
|
-
# * #fnmatch(pattern, *args)
|
126
|
-
# * #fnmatch?(pattern, *args)
|
127
|
-
# * #ftype
|
128
|
-
# * #make_link(old)
|
129
|
-
# * #open(*args, &block)
|
130
|
-
# * #readlink
|
131
|
-
# * #rename(to)
|
132
|
-
# * #stat
|
133
|
-
# * #lstat
|
134
|
-
# * #make_symlink(old)
|
135
|
-
# * #truncate(length)
|
136
|
-
# * #utime(atime, mtime)
|
137
|
-
# * #basename(*args)
|
138
|
-
# * #dirname
|
139
|
-
# * #extname
|
140
|
-
# * #expand_path(*args)
|
141
|
-
# * #split
|
142
|
-
#
|
143
|
-
#
|
144
|
-
# ### Directory methods
|
145
|
-
#
|
146
|
-
# These methods are a facade for Dir:
|
147
|
-
# * Pathname.glob(*args)
|
148
|
-
# * Pathname.getwd / Pathname.pwd
|
149
|
-
# * #rmdir
|
150
|
-
# * #entries
|
151
|
-
# * #each_entry(&block)
|
152
|
-
# * #mkdir(*args)
|
153
|
-
# * #opendir(*args)
|
154
|
-
#
|
155
|
-
#
|
156
|
-
# ### IO
|
157
|
-
#
|
158
|
-
# These methods are a facade for IO:
|
159
|
-
# * #each_line(*args, &block)
|
160
|
-
# * #read(*args)
|
161
|
-
# * #binread(*args)
|
162
|
-
# * #readlines(*args)
|
163
|
-
# * #sysopen(*args)
|
164
|
-
#
|
165
|
-
#
|
166
|
-
# ### Utilities
|
167
|
-
#
|
168
|
-
# These methods are a mixture of Find, FileUtils, and others:
|
169
|
-
# * #find(&block)
|
170
|
-
# * #mkpath
|
171
|
-
# * #rmtree
|
172
|
-
# * #unlink / #delete
|
173
|
-
#
|
174
|
-
#
|
175
|
-
# ## Method documentation
|
176
|
-
#
|
177
|
-
# As the above section shows, most of the methods in Pathname are facades. The
|
178
|
-
# documentation for these methods generally just says, for instance, "See
|
179
|
-
# FileTest.writable?", as you should be familiar with the original method
|
180
|
-
# anyway, and its documentation (e.g. through `ri`) will contain more
|
181
|
-
# information. In some cases, a brief description will follow.
|
182
|
-
#
|
183
|
-
class Pathname
|
184
|
-
# Returns the current working directory as a Pathname.
|
185
|
-
#
|
186
|
-
# Pathname.getwd
|
187
|
-
# #=> #<Pathname:/home/zzak/projects/ruby>
|
188
|
-
#
|
189
|
-
# See Dir.getwd.
|
190
|
-
#
|
191
|
-
def self.getwd: () -> Pathname
|
192
|
-
|
193
|
-
# Returns or yields Pathname objects.
|
194
|
-
#
|
195
|
-
# Pathname.glob("lib/i*.rb")
|
196
|
-
# #=> [#<Pathname:lib/ipaddr.rb>, #<Pathname:lib/irb.rb>]
|
197
|
-
#
|
198
|
-
# See Dir.glob.
|
199
|
-
#
|
200
|
-
def self.glob: (String | Array[String] pattern, ?Integer flags) -> Array[Pathname]
|
201
|
-
| (String | Array[String] pattern, ?Integer flags) { (Pathname) -> untyped } -> nil
|
202
|
-
|
203
|
-
# Returns the current working directory as a Pathname.
|
204
|
-
#
|
205
|
-
# Pathname.getwd
|
206
|
-
# #=> #<Pathname:/home/zzak/projects/ruby>
|
207
|
-
#
|
208
|
-
# See Dir.getwd.
|
209
|
-
#
|
210
|
-
def self.pwd: () -> Pathname
|
211
|
-
|
212
|
-
public
|
213
|
-
|
214
|
-
# Appends a pathname fragment to `self` to produce a new Pathname object.
|
215
|
-
#
|
216
|
-
# p1 = Pathname.new("/usr") # Pathname:/usr
|
217
|
-
# p2 = p1 + "bin/ruby" # Pathname:/usr/bin/ruby
|
218
|
-
# p3 = p1 + "/etc/passwd" # Pathname:/etc/passwd
|
219
|
-
#
|
220
|
-
# # / is aliased to +.
|
221
|
-
# p4 = p1 / "bin/ruby" # Pathname:/usr/bin/ruby
|
222
|
-
# p5 = p1 / "/etc/passwd" # Pathname:/etc/passwd
|
223
|
-
#
|
224
|
-
# This method doesn't access the file system; it is pure string manipulation.
|
225
|
-
#
|
226
|
-
def +: (Pathname | String | _ToStr other) -> Pathname
|
227
|
-
|
228
|
-
alias / +
|
229
|
-
|
230
|
-
# Provides a case-sensitive comparison operator for pathnames.
|
231
|
-
#
|
232
|
-
# Pathname.new('/usr') <=> Pathname.new('/usr/bin')
|
233
|
-
# #=> -1
|
234
|
-
# Pathname.new('/usr/bin') <=> Pathname.new('/usr/bin')
|
235
|
-
# #=> 0
|
236
|
-
# Pathname.new('/usr/bin') <=> Pathname.new('/USR/BIN')
|
237
|
-
# #=> 1
|
238
|
-
#
|
239
|
-
# It will return `-1`, `0` or `1` depending on the value of the left argument
|
240
|
-
# relative to the right argument. Or it will return `nil` if the arguments are
|
241
|
-
# not comparable.
|
242
|
-
#
|
243
|
-
def <=>: (untyped other) -> Integer?
|
244
|
-
|
245
|
-
# Compare this pathname with `other`. The comparison is string-based. Be aware
|
246
|
-
# that two different paths (`foo.txt` and `./foo.txt`) can refer to the same
|
247
|
-
# file.
|
248
|
-
#
|
249
|
-
def ==: (untyped) -> bool
|
250
|
-
|
251
|
-
# Compare this pathname with `other`. The comparison is string-based. Be aware
|
252
|
-
# that two different paths (`foo.txt` and `./foo.txt`) can refer to the same
|
253
|
-
# file.
|
254
|
-
#
|
255
|
-
def ===: (untyped) -> bool
|
256
|
-
|
257
|
-
# Predicate method for testing whether a path is absolute.
|
258
|
-
#
|
259
|
-
# It returns `true` if the pathname begins with a slash.
|
260
|
-
#
|
261
|
-
# p = Pathname.new('/im/sure')
|
262
|
-
# p.absolute?
|
263
|
-
# #=> true
|
264
|
-
#
|
265
|
-
# p = Pathname.new('not/so/sure')
|
266
|
-
# p.absolute?
|
267
|
-
# #=> false
|
268
|
-
#
|
269
|
-
def absolute?: () -> bool
|
270
|
-
|
271
|
-
# Iterates over and yields a new Pathname object for each element in the given
|
272
|
-
# path in ascending order.
|
273
|
-
#
|
274
|
-
# Pathname.new('/path/to/some/file.rb').ascend {|v| p v}
|
275
|
-
# #<Pathname:/path/to/some/file.rb>
|
276
|
-
# #<Pathname:/path/to/some>
|
277
|
-
# #<Pathname:/path/to>
|
278
|
-
# #<Pathname:/path>
|
279
|
-
# #<Pathname:/>
|
280
|
-
#
|
281
|
-
# Pathname.new('path/to/some/file.rb').ascend {|v| p v}
|
282
|
-
# #<Pathname:path/to/some/file.rb>
|
283
|
-
# #<Pathname:path/to/some>
|
284
|
-
# #<Pathname:path/to>
|
285
|
-
# #<Pathname:path>
|
286
|
-
#
|
287
|
-
# Returns an Enumerator if no block was given.
|
288
|
-
#
|
289
|
-
# enum = Pathname.new("/usr/bin/ruby").ascend
|
290
|
-
# # ... do stuff ...
|
291
|
-
# enum.each { |e| ... }
|
292
|
-
# # yields Pathnames /usr/bin/ruby, /usr/bin, /usr, and /.
|
293
|
-
#
|
294
|
-
# It doesn't access the filesystem.
|
295
|
-
#
|
296
|
-
def ascend: () { (Pathname) -> untyped } -> nil
|
297
|
-
| () -> Enumerator[Pathname, nil]
|
298
|
-
|
299
|
-
# Returns the last access time for the file.
|
300
|
-
#
|
301
|
-
# See File.atime.
|
302
|
-
#
|
303
|
-
def atime: () -> Time
|
304
|
-
|
305
|
-
# Returns the last component of the path.
|
306
|
-
#
|
307
|
-
# See File.basename.
|
308
|
-
#
|
309
|
-
def basename: (?String | _ToStr suffix) -> Pathname
|
310
|
-
|
311
|
-
# Returns all the bytes from the file, or the first `N` if specified.
|
312
|
-
#
|
313
|
-
# See File.binread.
|
314
|
-
#
|
315
|
-
def binread: (?Integer length, ?Integer offset) -> String
|
316
|
-
|
317
|
-
# Writes `contents` to the file, opening it in binary mode.
|
318
|
-
#
|
319
|
-
# See File.binwrite.
|
320
|
-
#
|
321
|
-
def binwrite: (String, ?Integer offset,
|
322
|
-
?mode: Integer | String,
|
323
|
-
?flags: Integer,
|
324
|
-
?external_encoding: Encoding | string,
|
325
|
-
?internal_encoding: Encoding | string,
|
326
|
-
?encoding: Encoding | string,
|
327
|
-
?textmode: bool,
|
328
|
-
?binmode: bool,
|
329
|
-
?autoclose: bool,
|
330
|
-
|
331
|
-
# From String#encode
|
332
|
-
?invalid: :replace ?,
|
333
|
-
?undef: :replace ?,
|
334
|
-
?replace: String,
|
335
|
-
?fallback: Hash[String, String] | Proc | Method,
|
336
|
-
?xml: :text | :attr,
|
337
|
-
?universal_newline: true,
|
338
|
-
?cr_newline: true,
|
339
|
-
?crlf_newline: true,
|
340
|
-
) -> Integer
|
341
|
-
|
342
|
-
# Returns the birth time for the file. If the platform doesn't have birthtime,
|
343
|
-
# raises NotImplementedError.
|
344
|
-
#
|
345
|
-
# See File.birthtime.
|
346
|
-
#
|
347
|
-
def birthtime: () -> Time
|
348
|
-
|
349
|
-
# See FileTest.blockdev?.
|
350
|
-
#
|
351
|
-
def blockdev?: () -> bool
|
352
|
-
|
353
|
-
# See FileTest.chardev?.
|
354
|
-
#
|
355
|
-
def chardev?: () -> bool
|
356
|
-
|
357
|
-
# Returns the children of the directory (files and subdirectories, not
|
358
|
-
# recursive) as an array of Pathname objects.
|
359
|
-
#
|
360
|
-
# By default, the returned pathnames will have enough information to access the
|
361
|
-
# files. If you set `with_directory` to `false`, then the returned pathnames
|
362
|
-
# will contain the filename only.
|
363
|
-
#
|
364
|
-
# For example:
|
365
|
-
# pn = Pathname("/usr/lib/ruby/1.8")
|
366
|
-
# pn.children
|
367
|
-
# # -> [ Pathname:/usr/lib/ruby/1.8/English.rb,
|
368
|
-
# Pathname:/usr/lib/ruby/1.8/Env.rb,
|
369
|
-
# Pathname:/usr/lib/ruby/1.8/abbrev.rb, ... ]
|
370
|
-
# pn.children(false)
|
371
|
-
# # -> [ Pathname:English.rb, Pathname:Env.rb, Pathname:abbrev.rb, ... ]
|
372
|
-
#
|
373
|
-
# Note that the results never contain the entries `.` and `..` in the directory
|
374
|
-
# because they are not children.
|
375
|
-
#
|
376
|
-
def children: (?bool with_directory) -> untyped
|
377
|
-
|
378
|
-
# Changes file permissions.
|
379
|
-
#
|
380
|
-
# See File.chmod.
|
381
|
-
#
|
382
|
-
def chmod: (Integer mode_int) -> Integer
|
383
|
-
|
384
|
-
# Change owner and group of the file.
|
385
|
-
#
|
386
|
-
# See File.chown.
|
387
|
-
#
|
388
|
-
def chown: (Integer owner, Integer group) -> Integer
|
389
|
-
|
390
|
-
# Returns clean pathname of `self` with consecutive slashes and useless dots
|
391
|
-
# removed. The filesystem is not accessed.
|
392
|
-
#
|
393
|
-
# If `consider_symlink` is `true`, then a more conservative algorithm is used to
|
394
|
-
# avoid breaking symbolic linkages. This may retain more `..` entries than
|
395
|
-
# absolutely necessary, but without accessing the filesystem, this can't be
|
396
|
-
# avoided.
|
397
|
-
#
|
398
|
-
# See Pathname#realpath.
|
399
|
-
#
|
400
|
-
def cleanpath: (?bool consider_symlink) -> Pathname
|
401
|
-
|
402
|
-
# Returns the last change time, using directory information, not the file
|
403
|
-
# itself.
|
404
|
-
#
|
405
|
-
# See File.ctime.
|
406
|
-
#
|
407
|
-
def ctime: () -> Time
|
408
|
-
|
409
|
-
# Removes a file or directory, using File.unlink if `self` is a file, or
|
410
|
-
# Dir.unlink as necessary.
|
411
|
-
#
|
412
|
-
def delete: () -> Integer
|
413
|
-
|
414
|
-
# Iterates over and yields a new Pathname object for each element in the given
|
415
|
-
# path in descending order.
|
416
|
-
#
|
417
|
-
# Pathname.new('/path/to/some/file.rb').descend {|v| p v}
|
418
|
-
# #<Pathname:/>
|
419
|
-
# #<Pathname:/path>
|
420
|
-
# #<Pathname:/path/to>
|
421
|
-
# #<Pathname:/path/to/some>
|
422
|
-
# #<Pathname:/path/to/some/file.rb>
|
423
|
-
#
|
424
|
-
# Pathname.new('path/to/some/file.rb').descend {|v| p v}
|
425
|
-
# #<Pathname:path>
|
426
|
-
# #<Pathname:path/to>
|
427
|
-
# #<Pathname:path/to/some>
|
428
|
-
# #<Pathname:path/to/some/file.rb>
|
429
|
-
#
|
430
|
-
# Returns an Enumerator if no block was given.
|
431
|
-
#
|
432
|
-
# enum = Pathname.new("/usr/bin/ruby").descend
|
433
|
-
# # ... do stuff ...
|
434
|
-
# enum.each { |e| ... }
|
435
|
-
# # yields Pathnames /, /usr, /usr/bin, and /usr/bin/ruby.
|
436
|
-
#
|
437
|
-
# It doesn't access the filesystem.
|
438
|
-
#
|
439
|
-
def descend: () { (Pathname) -> untyped } -> nil
|
440
|
-
| () -> Enumerator[Pathname, nil]
|
441
|
-
|
442
|
-
# See FileTest.directory?.
|
443
|
-
#
|
444
|
-
def directory?: () -> bool
|
445
|
-
|
446
|
-
# Returns all but the last component of the path.
|
447
|
-
#
|
448
|
-
# See File.dirname.
|
449
|
-
#
|
450
|
-
def dirname: () -> Pathname
|
451
|
-
|
452
|
-
# Iterates over the children of the directory (files and subdirectories, not
|
453
|
-
# recursive).
|
454
|
-
#
|
455
|
-
# It yields Pathname object for each child.
|
456
|
-
#
|
457
|
-
# By default, the yielded pathnames will have enough information to access the
|
458
|
-
# files.
|
459
|
-
#
|
460
|
-
# If you set `with_directory` to `false`, then the returned pathnames will
|
461
|
-
# contain the filename only.
|
462
|
-
#
|
463
|
-
# Pathname("/usr/local").each_child {|f| p f }
|
464
|
-
# #=> #<Pathname:/usr/local/share>
|
465
|
-
# # #<Pathname:/usr/local/bin>
|
466
|
-
# # #<Pathname:/usr/local/games>
|
467
|
-
# # #<Pathname:/usr/local/lib>
|
468
|
-
# # #<Pathname:/usr/local/include>
|
469
|
-
# # #<Pathname:/usr/local/sbin>
|
470
|
-
# # #<Pathname:/usr/local/src>
|
471
|
-
# # #<Pathname:/usr/local/man>
|
472
|
-
#
|
473
|
-
# Pathname("/usr/local").each_child(false) {|f| p f }
|
474
|
-
# #=> #<Pathname:share>
|
475
|
-
# # #<Pathname:bin>
|
476
|
-
# # #<Pathname:games>
|
477
|
-
# # #<Pathname:lib>
|
478
|
-
# # #<Pathname:include>
|
479
|
-
# # #<Pathname:sbin>
|
480
|
-
# # #<Pathname:src>
|
481
|
-
# # #<Pathname:man>
|
482
|
-
#
|
483
|
-
# Note that the results never contain the entries `.` and `..` in the directory
|
484
|
-
# because they are not children.
|
485
|
-
#
|
486
|
-
# See Pathname#children
|
487
|
-
#
|
488
|
-
def each_child: (?bool with_directory) { (Pathname) -> void } -> Array[Pathname]
|
489
|
-
| (?bool with_directory) -> Enumerator[Pathname, Array[Pathname]]
|
490
|
-
|
491
|
-
# Iterates over the entries (files and subdirectories) in the directory,
|
492
|
-
# yielding a Pathname object for each entry.
|
493
|
-
#
|
494
|
-
def each_entry: () { (Pathname) -> untyped } -> nil
|
495
|
-
|
496
|
-
# Iterates over each component of the path.
|
497
|
-
#
|
498
|
-
# Pathname.new("/usr/bin/ruby").each_filename {|filename| ... }
|
499
|
-
# # yields "usr", "bin", and "ruby".
|
500
|
-
#
|
501
|
-
# Returns an Enumerator if no block was given.
|
502
|
-
#
|
503
|
-
# enum = Pathname.new("/usr/bin/ruby").each_filename
|
504
|
-
# # ... do stuff ...
|
505
|
-
# enum.each { |e| ... }
|
506
|
-
# # yields "usr", "bin", and "ruby".
|
507
|
-
#
|
508
|
-
def each_filename: () { (String) -> untyped } -> nil
|
509
|
-
| () -> Enumerator[String, nil]
|
510
|
-
|
511
|
-
# Iterates over each line in the file and yields a String object for each.
|
512
|
-
#
|
513
|
-
def each_line: (?String sep, ?Integer limit,
|
514
|
-
# open_args
|
515
|
-
?mode: Integer | String,
|
516
|
-
?flags: Integer,
|
517
|
-
?external_encoding: Encoding | string,
|
518
|
-
?internal_encoding: Encoding | string,
|
519
|
-
?encoding: Encoding | string,
|
520
|
-
?textmode: bool,
|
521
|
-
?binmode: bool,
|
522
|
-
?autoclose: bool,
|
523
|
-
# getline_args
|
524
|
-
?chomp: bool,
|
525
|
-
) { (String) -> untyped } -> nil
|
526
|
-
| (Integer limit,
|
527
|
-
# open_args
|
528
|
-
?mode: Integer | String,
|
529
|
-
?flags: Integer,
|
530
|
-
?external_encoding: Encoding | string,
|
531
|
-
?internal_encoding: Encoding | string,
|
532
|
-
?encoding: Encoding | string,
|
533
|
-
?textmode: bool,
|
534
|
-
?binmode: bool,
|
535
|
-
?autoclose: bool,
|
536
|
-
# getline_args
|
537
|
-
?chomp: bool,
|
538
|
-
) { (String) -> untyped } -> nil
|
539
|
-
| (?String sep, ?Integer limit,
|
540
|
-
# open_args
|
541
|
-
?mode: Integer | String,
|
542
|
-
?flags: Integer,
|
543
|
-
?external_encoding: Encoding | string,
|
544
|
-
?internal_encoding: Encoding | string,
|
545
|
-
?encoding: Encoding | string,
|
546
|
-
?textmode: bool,
|
547
|
-
?binmode: bool,
|
548
|
-
?autoclose: bool,
|
549
|
-
# getline_args
|
550
|
-
?chomp: bool,
|
551
|
-
) -> Enumerator[String, nil]
|
552
|
-
| (Integer limit,
|
553
|
-
# open_args
|
554
|
-
?mode: Integer | String,
|
555
|
-
?flags: Integer,
|
556
|
-
?external_encoding: Encoding | string,
|
557
|
-
?internal_encoding: Encoding | string,
|
558
|
-
?encoding: Encoding | string,
|
559
|
-
?textmode: bool,
|
560
|
-
?binmode: bool,
|
561
|
-
?autoclose: bool,
|
562
|
-
# getline_args
|
563
|
-
?chomp: bool,
|
564
|
-
) -> Enumerator[String, nil]
|
565
|
-
|
566
|
-
# Tests the file is empty.
|
567
|
-
#
|
568
|
-
# See Dir#empty? and FileTest.empty?.
|
569
|
-
#
|
570
|
-
def empty?: () -> bool
|
571
|
-
|
572
|
-
# Return the entries (files and subdirectories) in the directory, each as a
|
573
|
-
# Pathname object.
|
574
|
-
#
|
575
|
-
# The results contains just the names in the directory, without any trailing
|
576
|
-
# slashes or recursive look-up.
|
577
|
-
#
|
578
|
-
# pp Pathname.new('/usr/local').entries
|
579
|
-
# #=> [#<Pathname:share>,
|
580
|
-
# # #<Pathname:lib>,
|
581
|
-
# # #<Pathname:..>,
|
582
|
-
# # #<Pathname:include>,
|
583
|
-
# # #<Pathname:etc>,
|
584
|
-
# # #<Pathname:bin>,
|
585
|
-
# # #<Pathname:man>,
|
586
|
-
# # #<Pathname:games>,
|
587
|
-
# # #<Pathname:.>,
|
588
|
-
# # #<Pathname:sbin>,
|
589
|
-
# # #<Pathname:src>]
|
590
|
-
#
|
591
|
-
# The result may contain the current directory `#<Pathname:.>` and the parent
|
592
|
-
# directory `#<Pathname:..>`.
|
593
|
-
#
|
594
|
-
# If you don't want `.` and `..` and want directories, consider
|
595
|
-
# Pathname#children.
|
596
|
-
#
|
597
|
-
def entries: () -> Array[Pathname]
|
598
|
-
|
599
|
-
# Compare this pathname with `other`. The comparison is string-based. Be aware
|
600
|
-
# that two different paths (`foo.txt` and `./foo.txt`) can refer to the same
|
601
|
-
# file.
|
602
|
-
#
|
603
|
-
def eql?: (untyped) -> bool
|
604
|
-
|
605
|
-
# See FileTest.executable?.
|
606
|
-
#
|
607
|
-
def executable?: () -> bool
|
608
|
-
|
609
|
-
# See FileTest.executable_real?.
|
610
|
-
#
|
611
|
-
def executable_real?: () -> bool
|
612
|
-
|
613
|
-
# See FileTest.exist?.
|
614
|
-
#
|
615
|
-
def exist?: () -> bool
|
616
|
-
|
617
|
-
# Returns the absolute path for the file.
|
618
|
-
#
|
619
|
-
# See File.expand_path.
|
620
|
-
#
|
621
|
-
def expand_path: (?String dir) -> Pathname
|
622
|
-
|
623
|
-
# Returns the file's extension.
|
624
|
-
#
|
625
|
-
# See File.extname.
|
626
|
-
#
|
627
|
-
def extname: () -> String
|
628
|
-
|
629
|
-
# See FileTest.file?.
|
630
|
-
#
|
631
|
-
def file?: () -> bool
|
632
|
-
|
633
|
-
# Iterates over the directory tree in a depth first manner, yielding a Pathname
|
634
|
-
# for each file under "this" directory.
|
635
|
-
#
|
636
|
-
# Returns an Enumerator if no block is given.
|
637
|
-
#
|
638
|
-
# Since it is implemented by the standard library module Find, Find.prune can be
|
639
|
-
# used to control the traversal.
|
640
|
-
#
|
641
|
-
# If `self` is `.`, yielded pathnames begin with a filename in the current
|
642
|
-
# directory, not `./`.
|
643
|
-
#
|
644
|
-
# See Find.find
|
645
|
-
#
|
646
|
-
def find: (?ignore_error: bool) { (Pathname) -> untyped } -> nil
|
647
|
-
| (?ignore_error: bool) -> Enumerator[Pathname, nil]
|
648
|
-
|
649
|
-
# Return `true` if the receiver matches the given pattern.
|
650
|
-
#
|
651
|
-
# See File.fnmatch.
|
652
|
-
#
|
653
|
-
def fnmatch: (String pattern, ?Integer flags) -> bool
|
654
|
-
|
655
|
-
# Return `true` if the receiver matches the given pattern.
|
656
|
-
#
|
657
|
-
# See File.fnmatch.
|
658
|
-
#
|
659
|
-
alias fnmatch? fnmatch
|
660
|
-
|
661
|
-
# Freezes this Pathname.
|
662
|
-
#
|
663
|
-
# See Object.freeze.
|
664
|
-
#
|
665
|
-
def freeze: () -> Pathname
|
666
|
-
|
667
|
-
# Returns "type" of file ("file", "directory", etc).
|
668
|
-
#
|
669
|
-
# See File.ftype.
|
670
|
-
#
|
671
|
-
def ftype: () -> String
|
672
|
-
|
673
|
-
# Returns or yields Pathname objects.
|
674
|
-
#
|
675
|
-
# Pathname("ruby-2.4.2").glob("R*.md")
|
676
|
-
# #=> [#<Pathname:ruby-2.4.2/README.md>, #<Pathname:ruby-2.4.2/README.ja.md>]
|
677
|
-
#
|
678
|
-
# See Dir.glob. This method uses the `base` keyword argument of Dir.glob.
|
679
|
-
#
|
680
|
-
def glob: (String | Array[String] pattern, ?Integer flags) -> Array[Pathname]
|
681
|
-
| (String | Array[String] pattern, ?Integer flags) { (Pathname) -> untyped } -> nil
|
682
|
-
|
683
|
-
# See FileTest.grpowned?.
|
684
|
-
#
|
685
|
-
def grpowned?: () -> bool
|
686
|
-
|
687
|
-
def hash: () -> Integer
|
688
|
-
|
689
|
-
def inspect: () -> String
|
690
|
-
|
691
|
-
# Joins the given pathnames onto `self` to create a new Pathname object.
|
692
|
-
#
|
693
|
-
# path0 = Pathname.new("/usr") # Pathname:/usr
|
694
|
-
# path0 = path0.join("bin/ruby") # Pathname:/usr/bin/ruby
|
695
|
-
# # is the same as
|
696
|
-
# path1 = Pathname.new("/usr") + "bin/ruby" # Pathname:/usr/bin/ruby
|
697
|
-
# path0 == path1
|
698
|
-
# #=> true
|
699
|
-
#
|
700
|
-
def join: (*String | _ToStr | Pathname args) -> Pathname
|
701
|
-
|
702
|
-
# Same as Pathname.chmod, but does not follow symbolic links.
|
703
|
-
#
|
704
|
-
# See File.lchmod.
|
705
|
-
#
|
706
|
-
def lchmod: (Integer mode) -> Integer
|
707
|
-
|
708
|
-
# Same as Pathname.chown, but does not follow symbolic links.
|
709
|
-
#
|
710
|
-
# See File.lchown.
|
711
|
-
#
|
712
|
-
def lchown: (Integer owner, Integer group) -> Integer
|
713
|
-
|
714
|
-
# See File.lstat.
|
715
|
-
#
|
716
|
-
def lstat: () -> ::File::Stat
|
717
|
-
|
718
|
-
# Creates a hard link at *pathname*.
|
719
|
-
#
|
720
|
-
# See File.link.
|
721
|
-
#
|
722
|
-
def make_link: (String | Pathname | _ToStr old) -> Integer
|
723
|
-
|
724
|
-
# Creates a symbolic link.
|
725
|
-
#
|
726
|
-
# See File.symlink.
|
727
|
-
#
|
728
|
-
def make_symlink: (String | Pathname | _ToStr old) -> Integer
|
729
|
-
|
730
|
-
# Create the referenced directory.
|
731
|
-
#
|
732
|
-
# See Dir.mkdir.
|
733
|
-
#
|
734
|
-
def mkdir: (?Integer perm) -> Integer
|
735
|
-
|
736
|
-
# Creates a full path, including any intermediate directories that don't yet
|
737
|
-
# exist.
|
738
|
-
#
|
739
|
-
# See FileUtils.mkpath and FileUtils.mkdir_p
|
740
|
-
#
|
741
|
-
def mkpath: () -> nil
|
742
|
-
|
743
|
-
# Returns `true` if `self` points to a mountpoint.
|
744
|
-
#
|
745
|
-
def mountpoint?: () -> bool
|
746
|
-
|
747
|
-
# Returns the last modified time of the file.
|
748
|
-
#
|
749
|
-
# See File.mtime.
|
750
|
-
#
|
751
|
-
def mtime: () -> Time
|
752
|
-
|
753
|
-
# Opens the file for reading or writing.
|
754
|
-
#
|
755
|
-
# See File.open.
|
756
|
-
#
|
757
|
-
def open: (?String mode, ?Integer perm) -> File
|
758
|
-
| [T] (?String mode, ?Integer perm) { (File) -> T } -> T
|
759
|
-
|
760
|
-
# Opens the referenced directory.
|
761
|
-
#
|
762
|
-
# See Dir.open.
|
763
|
-
#
|
764
|
-
def opendir: () -> Dir
|
765
|
-
| [U] () { (Dir) -> U } -> U
|
766
|
-
|
767
|
-
# See FileTest.owned?.
|
768
|
-
#
|
769
|
-
def owned?: () -> bool
|
770
|
-
|
771
|
-
# Returns the parent directory.
|
772
|
-
#
|
773
|
-
# This is same as `self + '..'`.
|
774
|
-
#
|
775
|
-
def parent: () -> Pathname
|
776
|
-
|
777
|
-
# See FileTest.pipe?.
|
778
|
-
#
|
779
|
-
def pipe?: () -> bool
|
780
|
-
|
781
|
-
# Returns all data from the file, or the first `N` bytes if specified.
|
782
|
-
#
|
783
|
-
# See File.read.
|
784
|
-
#
|
785
|
-
def read: (?Integer length, ?Integer offset,
|
786
|
-
# open_args
|
787
|
-
?mode: Integer | String,
|
788
|
-
?flags: Integer,
|
789
|
-
?external_encoding: Encoding | string,
|
790
|
-
?internal_encoding: Encoding | string,
|
791
|
-
?encoding: Encoding | string,
|
792
|
-
?textmode: bool,
|
793
|
-
?binmode: bool,
|
794
|
-
?autoclose: bool,
|
795
|
-
) -> String
|
796
|
-
|
797
|
-
# See FileTest.readable?.
|
798
|
-
#
|
799
|
-
def readable?: () -> bool
|
800
|
-
|
801
|
-
# See FileTest.readable_real?.
|
802
|
-
#
|
803
|
-
def readable_real?: () -> bool
|
804
|
-
|
805
|
-
# Returns all the lines from the file.
|
806
|
-
#
|
807
|
-
# See File.readlines.
|
808
|
-
#
|
809
|
-
def readlines: (?String sep, ?Integer limit,
|
810
|
-
# open_args
|
811
|
-
?mode: Integer | String,
|
812
|
-
?flags: Integer,
|
813
|
-
?external_encoding: Encoding | string,
|
814
|
-
?internal_encoding: Encoding | string,
|
815
|
-
?encoding: Encoding | string,
|
816
|
-
?textmode: bool,
|
817
|
-
?binmode: bool,
|
818
|
-
?autoclose: bool,
|
819
|
-
# getline_args
|
820
|
-
?chomp: bool,
|
821
|
-
) -> Array[String]
|
822
|
-
| (Integer limit,
|
823
|
-
# open_args
|
824
|
-
?mode: Integer | String,
|
825
|
-
?flags: Integer,
|
826
|
-
?external_encoding: Encoding | string,
|
827
|
-
?internal_encoding: Encoding | string,
|
828
|
-
?encoding: Encoding | string,
|
829
|
-
?textmode: bool,
|
830
|
-
?binmode: bool,
|
831
|
-
?autoclose: bool,
|
832
|
-
# getline_args
|
833
|
-
?chomp: bool,
|
834
|
-
) -> Array[String]
|
835
|
-
|
836
|
-
# Read symbolic link.
|
837
|
-
#
|
838
|
-
# See File.readlink.
|
839
|
-
#
|
840
|
-
def readlink: () -> untyped
|
841
|
-
|
842
|
-
# Returns the real (absolute) pathname of `self` in the actual filesystem.
|
843
|
-
#
|
844
|
-
# Does not contain symlinks or useless dots, `..` and `.`.
|
845
|
-
#
|
846
|
-
# The last component of the real pathname can be nonexistent.
|
847
|
-
#
|
848
|
-
def realdirpath: (?string | Pathname base_dir) -> Pathname
|
849
|
-
|
850
|
-
# Returns the real (absolute) pathname for `self` in the actual filesystem.
|
851
|
-
#
|
852
|
-
# Does not contain symlinks or useless dots, `..` and `.`.
|
853
|
-
#
|
854
|
-
# All components of the pathname must exist when this method is called.
|
855
|
-
#
|
856
|
-
def realpath: (?string | Pathname base_dir) -> Pathname
|
857
|
-
|
858
|
-
# The opposite of Pathname#absolute?
|
859
|
-
#
|
860
|
-
# It returns `false` if the pathname begins with a slash.
|
861
|
-
#
|
862
|
-
# p = Pathname.new('/im/sure')
|
863
|
-
# p.relative?
|
864
|
-
# #=> false
|
865
|
-
#
|
866
|
-
# p = Pathname.new('not/so/sure')
|
867
|
-
# p.relative?
|
868
|
-
# #=> true
|
869
|
-
#
|
870
|
-
def relative?: () -> bool
|
871
|
-
|
872
|
-
# Returns a relative path from the given `base_directory` to the receiver.
|
873
|
-
#
|
874
|
-
# If `self` is absolute, then `base_directory` must be absolute too.
|
875
|
-
#
|
876
|
-
# If `self` is relative, then `base_directory` must be relative too.
|
877
|
-
#
|
878
|
-
# This method doesn't access the filesystem. It assumes no symlinks.
|
879
|
-
#
|
880
|
-
# ArgumentError is raised when it cannot find a relative path.
|
881
|
-
#
|
882
|
-
def relative_path_from: (Pathname | string base_directory) -> Pathname
|
883
|
-
|
884
|
-
# Rename the file.
|
885
|
-
#
|
886
|
-
# See File.rename.
|
887
|
-
#
|
888
|
-
def rename: (Pathname | string new_name) -> 0
|
889
|
-
|
890
|
-
# Remove the referenced directory.
|
891
|
-
#
|
892
|
-
# See Dir.rmdir.
|
893
|
-
#
|
894
|
-
def rmdir: () -> 0
|
895
|
-
|
896
|
-
# Recursively deletes a directory, including all directories beneath it.
|
897
|
-
#
|
898
|
-
# See FileUtils.rm_r
|
899
|
-
#
|
900
|
-
def rmtree: () -> void
|
901
|
-
|
902
|
-
# Predicate method for root directories. Returns `true` if the pathname
|
903
|
-
# consists of consecutive slashes.
|
904
|
-
#
|
905
|
-
# It doesn't access the filesystem. So it may return `false` for some pathnames
|
906
|
-
# which points to roots such as `/usr/..`.
|
907
|
-
#
|
908
|
-
def root?: () -> bool
|
909
|
-
|
910
|
-
# See FileTest.setgid?.
|
911
|
-
#
|
912
|
-
def setgid?: () -> bool
|
913
|
-
|
914
|
-
# See FileTest.setuid?.
|
915
|
-
#
|
916
|
-
def setuid?: () -> bool
|
917
|
-
|
918
|
-
# See FileTest.size.
|
919
|
-
#
|
920
|
-
def size: () -> Integer
|
921
|
-
|
922
|
-
# See FileTest.size?.
|
923
|
-
#
|
924
|
-
def size?: () -> Integer?
|
925
|
-
|
926
|
-
# See FileTest.socket?.
|
927
|
-
#
|
928
|
-
def socket?: () -> untyped
|
929
|
-
|
930
|
-
# Returns the #dirname and the #basename in an Array.
|
931
|
-
#
|
932
|
-
# See File.split.
|
933
|
-
#
|
934
|
-
def split: () -> [Pathname, Pathname]
|
935
|
-
|
936
|
-
# Returns a File::Stat object.
|
937
|
-
#
|
938
|
-
# See File.stat.
|
939
|
-
#
|
940
|
-
def stat: () -> File::Stat
|
941
|
-
|
942
|
-
# See FileTest.sticky?.
|
943
|
-
#
|
944
|
-
def sticky?: () -> untyped
|
945
|
-
|
946
|
-
# Return a pathname which is substituted by String#sub.
|
947
|
-
#
|
948
|
-
# path1 = Pathname.new('/usr/bin/perl')
|
949
|
-
# path1.sub('perl', 'ruby')
|
950
|
-
# #=> #<Pathname:/usr/bin/ruby>
|
951
|
-
#
|
952
|
-
def sub: (Regexp | string pattern, string | Hash[String, String] replacement) -> Pathname
|
953
|
-
| (Regexp | string pattern) { (String match) -> string } -> Pathname
|
954
|
-
|
955
|
-
# Return a pathname with `repl` added as a suffix to the basename.
|
956
|
-
#
|
957
|
-
# If self has no extension part, `repl` is appended.
|
958
|
-
#
|
959
|
-
# Pathname.new('/usr/bin/shutdown').sub_ext('.rb')
|
960
|
-
# #=> #<Pathname:/usr/bin/shutdown.rb>
|
961
|
-
#
|
962
|
-
def sub_ext: (string replacement) -> Pathname
|
963
|
-
|
964
|
-
# See FileTest.symlink?.
|
965
|
-
#
|
966
|
-
def symlink?: () -> untyped
|
967
|
-
|
968
|
-
# See IO.sysopen.
|
969
|
-
#
|
970
|
-
def sysopen: (?String mode, ?Integer perm) -> Integer
|
971
|
-
|
972
|
-
# Returns pathname. This method is deprecated and will be removed in Ruby 3.2.
|
973
|
-
#
|
974
|
-
def taint: () -> Pathname
|
975
|
-
|
976
|
-
# Return the path as a String.
|
977
|
-
#
|
978
|
-
# to_path is implemented so Pathname objects are usable with File.open, etc.
|
979
|
-
#
|
980
|
-
def to_path: () -> String
|
981
|
-
|
982
|
-
# Return the path as a String.
|
983
|
-
#
|
984
|
-
# to_path is implemented so Pathname objects are usable with File.open, etc.
|
985
|
-
#
|
986
|
-
alias to_s to_path
|
987
|
-
|
988
|
-
# Truncates the file to `length` bytes.
|
989
|
-
#
|
990
|
-
# See File.truncate.
|
991
|
-
#
|
992
|
-
def truncate: (Integer length) -> 0
|
993
|
-
|
994
|
-
# Removes a file or directory, using File.unlink if `self` is a file, or
|
995
|
-
# Dir.unlink as necessary.
|
996
|
-
#
|
997
|
-
def unlink: () -> Integer
|
998
|
-
|
999
|
-
# Returns pathname. This method is deprecated and will be removed in Ruby 3.2.
|
1000
|
-
#
|
1001
|
-
def untaint: () -> Pathname
|
1002
|
-
|
1003
|
-
# Update the access and modification times of the file.
|
1004
|
-
#
|
1005
|
-
# See File.utime.
|
1006
|
-
#
|
1007
|
-
def utime: (Integer | Time atime, Integer | Time mtime) -> Integer
|
1008
|
-
|
1009
|
-
# See FileTest.world_readable?.
|
1010
|
-
#
|
1011
|
-
def world_readable?: () -> (Integer | nil)
|
1012
|
-
|
1013
|
-
# See FileTest.world_writable?.
|
1014
|
-
#
|
1015
|
-
def world_writable?: () -> (Integer | nil)
|
1016
|
-
|
1017
|
-
# See FileTest.writable?.
|
1018
|
-
#
|
1019
|
-
def writable?: () -> bool
|
1020
|
-
|
1021
|
-
# See FileTest.writable_real?.
|
1022
|
-
#
|
1023
|
-
def writable_real?: () -> bool
|
1024
|
-
|
1025
|
-
# Writes `contents` to the file.
|
1026
|
-
#
|
1027
|
-
# See File.write.
|
1028
|
-
#
|
1029
|
-
def write: (String content, ?Integer offset,
|
1030
|
-
# open_args
|
1031
|
-
?mode: Integer | String,
|
1032
|
-
?flags: Integer,
|
1033
|
-
?external_encoding: Encoding | string,
|
1034
|
-
?internal_encoding: Encoding | string,
|
1035
|
-
?encoding: Encoding | string,
|
1036
|
-
?textmode: bool,
|
1037
|
-
?binmode: bool,
|
1038
|
-
?autoclose: bool,
|
1039
|
-
) -> Integer
|
1040
|
-
|
1041
|
-
# See FileTest.zero?.
|
1042
|
-
#
|
1043
|
-
def zero?: () -> bool
|
1044
|
-
|
1045
|
-
private
|
1046
|
-
|
1047
|
-
def add_trailing_separator: (untyped path) -> untyped
|
1048
|
-
|
1049
|
-
def chop_basename: (untyped path) -> untyped
|
1050
|
-
|
1051
|
-
def cleanpath_aggressive: () -> untyped
|
1052
|
-
|
1053
|
-
def cleanpath_conservative: () -> untyped
|
1054
|
-
|
1055
|
-
def del_trailing_separator: (untyped path) -> untyped
|
1056
|
-
|
1057
|
-
def has_trailing_separator?: (untyped path) -> untyped
|
1058
|
-
|
1059
|
-
# Create a Pathname object from the given String (or String-like object). If
|
1060
|
-
# `path` contains a NULL character (`\0`), an ArgumentError is raised.
|
1061
|
-
#
|
1062
|
-
def initialize: (string | Pathname) -> void
|
1063
|
-
|
1064
|
-
def plus: (untyped path1, untyped path2) -> untyped
|
1065
|
-
|
1066
|
-
def prepend_prefix: (untyped prefix, untyped relpath) -> untyped
|
1067
|
-
|
1068
|
-
def split_names: (untyped path) -> untyped
|
1069
|
-
end
|
1070
|
-
|
1071
|
-
Pathname::SAME_PATHS: Proc
|
1072
|
-
|
1073
|
-
Pathname::SEPARATOR_LIST: String
|
1074
|
-
|
1075
|
-
Pathname::SEPARATOR_PAT: Regexp
|
1076
|
-
|
1077
|
-
Pathname::TO_PATH: Symbol
|
1078
|
-
|
1079
|
-
extension Kernel (Pathname)
|
1080
|
-
# Creates a new Pathname object from the given string, `path`, and returns
|
1081
|
-
# pathname object.
|
1082
|
-
#
|
1083
|
-
# In order to use this constructor, you must first require the Pathname standard
|
1084
|
-
# library extension.
|
1085
|
-
#
|
1086
|
-
# require 'pathname'
|
1087
|
-
# Pathname("/home/zzak")
|
1088
|
-
# #=> #<Pathname:/home/zzak>
|
1089
|
-
#
|
1090
|
-
# See also Pathname::new for more information.
|
1091
|
-
#
|
1092
|
-
def Pathname: (String | Pathname) -> Pathname
|
1093
|
-
end
|