rbs 4.1.0.pre.1 → 4.1.0.pre.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/c-check.yml +3 -0
- data/.github/workflows/dependabot.yml +1 -1
- data/.github/workflows/jruby.yml +67 -0
- data/.github/workflows/milestone.yml +4 -1
- data/.github/workflows/ruby.yml +12 -0
- data/.github/workflows/rust.yml +3 -0
- data/.github/workflows/truffleruby.yml +54 -0
- data/.github/workflows/typecheck.yml +3 -0
- data/.github/workflows/wasm.yml +53 -0
- data/.github/workflows/windows.yml +6 -0
- data/.gitignore +7 -0
- data/README.md +3 -3
- data/Rakefile +116 -1
- data/Steepfile +7 -0
- data/core/array.rbs +144 -144
- data/core/builtin.rbs +6 -6
- data/core/enumerable.rbs +109 -109
- data/core/enumerator/product.rbs +5 -5
- data/core/enumerator.rbs +28 -28
- data/core/file.rbs +24 -1018
- data/core/file_constants.rbs +463 -0
- data/core/file_stat.rbs +534 -0
- data/core/hash.rbs +117 -101
- data/core/integer.rbs +21 -58
- data/core/io.rbs +25 -7
- data/core/module.rbs +88 -74
- data/core/numeric.rbs +3 -0
- data/core/object_space/weak_key_map.rbs +7 -7
- data/core/range.rbs +23 -23
- data/core/rbs/ops.rbs +154 -0
- data/core/rbs/unnamed/argf.rbs +3 -3
- data/core/set.rbs +3 -3
- data/core/struct.rbs +16 -16
- data/core/thread.rbs +6 -6
- data/docs/CONTRIBUTING.md +2 -1
- data/docs/inline.md +36 -6
- data/docs/rbs_by_example.md +20 -20
- data/docs/syntax.md +2 -2
- data/docs/wasm_serialization.md +80 -0
- data/ext/rbs_extension/ast_translation.c +1294 -973
- data/ext/rbs_extension/ast_translation.h +4 -0
- data/ext/rbs_extension/main.c +139 -4
- data/include/rbs/ast.h +9 -1
- data/include/rbs/serialize.h +39 -0
- data/lib/rbs/ast/ruby/comment_block.rb +6 -4
- data/lib/rbs/ast/ruby/helpers/location_helper.rb +1 -1
- data/lib/rbs/ast/ruby/members.rb +12 -1
- data/lib/rbs/buffer.rb +48 -11
- data/lib/rbs/collection/sources/git.rb +6 -0
- data/lib/rbs/definition_builder/method_builder.rb +12 -6
- data/lib/rbs/environment.rb +4 -3
- data/lib/rbs/inline_parser.rb +5 -3
- data/lib/rbs/namespace.rb +47 -11
- data/lib/rbs/prototype/runtime.rb +2 -0
- data/lib/rbs/resolver/type_name_resolver.rb +12 -14
- data/lib/rbs/type_name.rb +33 -13
- data/lib/rbs/unit_test/type_assertions.rb +9 -0
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs/wasm/deserializer.rb +213 -0
- data/lib/rbs/wasm/location.rb +61 -0
- data/lib/rbs/wasm/parser.rb +137 -0
- data/lib/rbs/wasm/runtime.rb +217 -0
- data/lib/rbs/wasm/serialization_schema.rb +110 -0
- data/lib/rbs.rb +13 -2
- data/rbs.gemspec +19 -2
- data/sig/ast/ruby/members.rbs +6 -1
- data/sig/buffer.rbs +19 -1
- data/sig/namespace.rbs +20 -0
- data/sig/parser.rbs +10 -0
- data/sig/resolver/type_name_resolver.rbs +2 -4
- data/sig/typename.rbs +15 -0
- data/sig/unit_test/type_assertions.rbs +4 -0
- data/sig/wasm/deserializer.rbs +66 -0
- data/sig/wasm/serialization_schema.rbs +13 -0
- data/src/ast.c +78 -78
- data/src/lexstate.c +5 -1
- data/src/serialize.c +958 -0
- data/src/util/rbs_allocator.c +1 -4
- data/stdlib/abbrev/0/array.rbs +1 -1
- data/stdlib/csv/0/csv.rbs +5 -5
- data/stdlib/digest/0/digest.rbs +1 -1
- data/stdlib/etc/0/etc.rbs +18 -4
- data/stdlib/fileutils/0/fileutils.rbs +21 -21
- data/stdlib/json/0/json.rbs +6 -6
- data/stdlib/openssl/0/openssl.rbs +5 -5
- data/stdlib/resolv/0/resolv.rbs +1 -1
- data/stdlib/shellwords/0/shellwords.rbs +1 -1
- data/stdlib/stringio/0/stringio.rbs +32 -10
- data/stdlib/strscan/0/string_scanner.rbs +74 -55
- data/stdlib/tsort/0/cyclic.rbs +1 -1
- data/stdlib/tsort/0/interfaces.rbs +8 -8
- data/stdlib/tsort/0/tsort.rbs +9 -9
- data/stdlib/zlib/0/gzip_reader.rbs +2 -2
- data/wasm/README.md +59 -0
- data/wasm/rbs_wasm.c +411 -0
- metadata +21 -5
- data/.vscode/extensions.json +0 -5
- data/.vscode/settings.json +0 -19
data/core/file.rbs
CHANGED
|
@@ -810,6 +810,30 @@
|
|
|
810
810
|
# * #truncate: Truncates `self` to the given size.
|
|
811
811
|
#
|
|
812
812
|
class File < IO
|
|
813
|
+
# The string that `File.ftype` and `File::Stat#ftype` return
|
|
814
|
+
type ftype = 'file' | 'directory' | 'characterSpecial' | 'blockSpecial'
|
|
815
|
+
| 'fifo' | 'link' | 'socket' | 'unknown'
|
|
816
|
+
|
|
817
|
+
# <!-- rdoc-file=file.c -->
|
|
818
|
+
# platform specific alternative separator
|
|
819
|
+
#
|
|
820
|
+
ALT_SEPARATOR: String?
|
|
821
|
+
|
|
822
|
+
# <!-- rdoc-file=file.c -->
|
|
823
|
+
# path list separator
|
|
824
|
+
#
|
|
825
|
+
PATH_SEPARATOR: String
|
|
826
|
+
|
|
827
|
+
# <!-- rdoc-file=file.c -->
|
|
828
|
+
# separates directory parts in path
|
|
829
|
+
#
|
|
830
|
+
SEPARATOR: String
|
|
831
|
+
|
|
832
|
+
# <!-- rdoc-file=file.c -->
|
|
833
|
+
# separates directory parts in path
|
|
834
|
+
#
|
|
835
|
+
Separator: String
|
|
836
|
+
|
|
813
837
|
# <!--
|
|
814
838
|
# rdoc-file=io.c
|
|
815
839
|
# - File.new(path, mode = 'r', perm = 0666, **opts) -> file
|
|
@@ -2019,1021 +2043,3 @@ class File < IO
|
|
|
2019
2043
|
#
|
|
2020
2044
|
def truncate: (int length) -> 0
|
|
2021
2045
|
end
|
|
2022
|
-
|
|
2023
|
-
# <!-- rdoc-file=file.c -->
|
|
2024
|
-
# platform specific alternative separator
|
|
2025
|
-
#
|
|
2026
|
-
File::ALT_SEPARATOR: String?
|
|
2027
|
-
|
|
2028
|
-
# <!-- rdoc-file=file.c -->
|
|
2029
|
-
# path list separator
|
|
2030
|
-
#
|
|
2031
|
-
File::PATH_SEPARATOR: String
|
|
2032
|
-
|
|
2033
|
-
# <!-- rdoc-file=file.c -->
|
|
2034
|
-
# separates directory parts in path
|
|
2035
|
-
#
|
|
2036
|
-
File::SEPARATOR: String
|
|
2037
|
-
|
|
2038
|
-
# <!-- rdoc-file=file.c -->
|
|
2039
|
-
# separates directory parts in path
|
|
2040
|
-
#
|
|
2041
|
-
File::Separator: String
|
|
2042
|
-
|
|
2043
|
-
# <!-- rdoc-file=file.c -->
|
|
2044
|
-
# Module <code>File::Constants</code> defines file-related constants.
|
|
2045
|
-
#
|
|
2046
|
-
# There are two families of constants here:
|
|
2047
|
-
#
|
|
2048
|
-
# * Those having to do with [file
|
|
2049
|
-
# access](rdoc-ref:File::Constants@File+Access).
|
|
2050
|
-
# * Those having to do with [filename
|
|
2051
|
-
# globbing](rdoc-ref:File::Constants@Filename+Globbing+Constants+-28File-3A-
|
|
2052
|
-
# 3AFNM_-2A-29).
|
|
2053
|
-
#
|
|
2054
|
-
# File constants defined for the local process may be retrieved with method
|
|
2055
|
-
# File::Constants.constants:
|
|
2056
|
-
#
|
|
2057
|
-
# File::Constants.constants.take(5)
|
|
2058
|
-
# # => [:RDONLY, :WRONLY, :RDWR, :APPEND, :CREAT]
|
|
2059
|
-
#
|
|
2060
|
-
# ## File Access
|
|
2061
|
-
#
|
|
2062
|
-
# File-access constants may be used with optional argument `mode` in calls to
|
|
2063
|
-
# the following methods:
|
|
2064
|
-
#
|
|
2065
|
-
# * File.new.
|
|
2066
|
-
# * File.open.
|
|
2067
|
-
# * IO.for_fd.
|
|
2068
|
-
# * IO.new.
|
|
2069
|
-
# * IO.open.
|
|
2070
|
-
# * IO.popen.
|
|
2071
|
-
# * IO.reopen.
|
|
2072
|
-
# * IO.sysopen.
|
|
2073
|
-
# * StringIO.new.
|
|
2074
|
-
# * StringIO.open.
|
|
2075
|
-
# * StringIO#reopen.
|
|
2076
|
-
#
|
|
2077
|
-
# ### Read/Write Access
|
|
2078
|
-
#
|
|
2079
|
-
# Read-write access for a stream may be specified by a file-access constant.
|
|
2080
|
-
#
|
|
2081
|
-
# The constant may be specified as part of a bitwise OR of other such constants.
|
|
2082
|
-
#
|
|
2083
|
-
# Any combination of the constants in this section may be specified.
|
|
2084
|
-
#
|
|
2085
|
-
# #### File::RDONLY
|
|
2086
|
-
#
|
|
2087
|
-
# Flag File::RDONLY specifies the stream should be opened for reading only:
|
|
2088
|
-
#
|
|
2089
|
-
# filepath = '/tmp/t.tmp'
|
|
2090
|
-
# f = File.new(filepath, File::RDONLY)
|
|
2091
|
-
# f.write('Foo') # Raises IOError (not opened for writing).
|
|
2092
|
-
#
|
|
2093
|
-
# #### File::WRONLY
|
|
2094
|
-
#
|
|
2095
|
-
# Flag File::WRONLY specifies that the stream should be opened for writing only:
|
|
2096
|
-
#
|
|
2097
|
-
# f = File.new(filepath, File::WRONLY)
|
|
2098
|
-
# f.read # Raises IOError (not opened for reading).
|
|
2099
|
-
#
|
|
2100
|
-
# #### File::RDWR
|
|
2101
|
-
#
|
|
2102
|
-
# Flag File::RDWR specifies that the stream should be opened for both reading
|
|
2103
|
-
# and writing:
|
|
2104
|
-
#
|
|
2105
|
-
# f = File.new(filepath, File::RDWR)
|
|
2106
|
-
# f.write('Foo') # => 3
|
|
2107
|
-
# f.rewind # => 0
|
|
2108
|
-
# f.read # => "Foo"
|
|
2109
|
-
#
|
|
2110
|
-
# ### File Positioning
|
|
2111
|
-
#
|
|
2112
|
-
# #### File::APPEND
|
|
2113
|
-
#
|
|
2114
|
-
# Flag File::APPEND specifies that the stream should be opened in append mode.
|
|
2115
|
-
#
|
|
2116
|
-
# Before each write operation, the position is set to end-of-stream. The
|
|
2117
|
-
# modification of the position and the following write operation are performed
|
|
2118
|
-
# as a single atomic step.
|
|
2119
|
-
#
|
|
2120
|
-
# #### File::TRUNC
|
|
2121
|
-
#
|
|
2122
|
-
# Flag File::TRUNC specifies that the stream should be truncated at its
|
|
2123
|
-
# beginning. If the file exists and is successfully opened for writing, it is to
|
|
2124
|
-
# be truncated to position zero; its ctime and mtime are updated.
|
|
2125
|
-
#
|
|
2126
|
-
# There is no effect on a FIFO special file or a terminal device. The effect on
|
|
2127
|
-
# other file types is implementation-defined. The result of using File::TRUNC
|
|
2128
|
-
# with File::RDONLY is undefined.
|
|
2129
|
-
#
|
|
2130
|
-
# ### Creating and Preserving
|
|
2131
|
-
#
|
|
2132
|
-
# #### File::CREAT
|
|
2133
|
-
#
|
|
2134
|
-
# Flag File::CREAT specifies that the stream should be created if it does not
|
|
2135
|
-
# already exist.
|
|
2136
|
-
#
|
|
2137
|
-
# If the file exists:
|
|
2138
|
-
#
|
|
2139
|
-
# - Raise an exception if File::EXCL is also specified.
|
|
2140
|
-
# - Otherwise, do nothing.
|
|
2141
|
-
#
|
|
2142
|
-
# If the file does not exist, then it is created. Upon successful completion,
|
|
2143
|
-
# the atime, ctime, and mtime of the file are updated, and the ctime and mtime
|
|
2144
|
-
# of the parent directory are updated.
|
|
2145
|
-
#
|
|
2146
|
-
# #### File::EXCL
|
|
2147
|
-
#
|
|
2148
|
-
# Flag File::EXCL specifies that the stream should not already exist; If flags
|
|
2149
|
-
# File::CREAT and File::EXCL are both specified and the stream already exists,
|
|
2150
|
-
# an exception is raised.
|
|
2151
|
-
#
|
|
2152
|
-
# The check for the existence and creation of the file is performed as an atomic
|
|
2153
|
-
# operation.
|
|
2154
|
-
#
|
|
2155
|
-
# If both File::EXCL and File::CREAT are specified and the path names a symbolic
|
|
2156
|
-
# link, an exception is raised regardless of the contents of the symbolic link.
|
|
2157
|
-
#
|
|
2158
|
-
# If File::EXCL is specified and File::CREAT is not specified, the result is
|
|
2159
|
-
# undefined.
|
|
2160
|
-
#
|
|
2161
|
-
# ### POSIX File Constants
|
|
2162
|
-
#
|
|
2163
|
-
# Some file-access constants are defined only on POSIX-compliant systems; those
|
|
2164
|
-
# are:
|
|
2165
|
-
#
|
|
2166
|
-
# * File::SYNC.
|
|
2167
|
-
# * File::DSYNC.
|
|
2168
|
-
# * File::RSYNC.
|
|
2169
|
-
# * File::DIRECT.
|
|
2170
|
-
# * File::NOATIME.
|
|
2171
|
-
# * File::NOCTTY.
|
|
2172
|
-
# * File::NOFOLLOW.
|
|
2173
|
-
# * File::TMPFILE.
|
|
2174
|
-
#
|
|
2175
|
-
# #### File::SYNC, File::RSYNC, and File::DSYNC
|
|
2176
|
-
#
|
|
2177
|
-
# Flag File::SYNC, File::RSYNC, or File::DSYNC specifies synchronization of I/O
|
|
2178
|
-
# operations with the underlying file system.
|
|
2179
|
-
#
|
|
2180
|
-
# These flags are valid only for POSIX-compliant systems.
|
|
2181
|
-
#
|
|
2182
|
-
# * File::SYNC specifies that all write operations (both data and metadata)
|
|
2183
|
-
# are immediately to be flushed to the underlying storage device. This means
|
|
2184
|
-
# that the data is written to the storage device, and the file's metadata
|
|
2185
|
-
# (e.g., file size, timestamps, permissions) are also synchronized. This
|
|
2186
|
-
# guarantees that data is safely stored on the storage medium before
|
|
2187
|
-
# returning control to the calling program. This flag can have a significant
|
|
2188
|
-
# impact on performance since it requires synchronous writes, which can be
|
|
2189
|
-
# slower compared to asynchronous writes.
|
|
2190
|
-
#
|
|
2191
|
-
# * File::RSYNC specifies that any read operations on the file will not return
|
|
2192
|
-
# until all outstanding write operations (those that have been issued but
|
|
2193
|
-
# not completed) are also synchronized. This is useful when you want to read
|
|
2194
|
-
# the most up-to-date data, which may still be in the process of being
|
|
2195
|
-
# written.
|
|
2196
|
-
#
|
|
2197
|
-
# * File::DSYNC specifies that all *data* write operations are immediately to
|
|
2198
|
-
# be flushed to the underlying storage device; this differs from File::SYNC,
|
|
2199
|
-
# which requires that *metadata* also be synchronized.
|
|
2200
|
-
#
|
|
2201
|
-
# Note that the behavior of these flags may vary slightly depending on the
|
|
2202
|
-
# operating system and filesystem being used. Additionally, using these flags
|
|
2203
|
-
# can have an impact on performance due to the synchronous nature of the I/O
|
|
2204
|
-
# operations, so they should be used judiciously, especially in
|
|
2205
|
-
# performance-critical applications.
|
|
2206
|
-
#
|
|
2207
|
-
# #### File::NOCTTY
|
|
2208
|
-
#
|
|
2209
|
-
# Flag File::NOCTTY specifies that if the stream is a terminal device, that
|
|
2210
|
-
# device does not become the controlling terminal for the process.
|
|
2211
|
-
#
|
|
2212
|
-
# Defined only for POSIX-compliant systems.
|
|
2213
|
-
#
|
|
2214
|
-
# #### File::DIRECT
|
|
2215
|
-
#
|
|
2216
|
-
# Flag File::DIRECT requests that cache effects of the I/O to and from the
|
|
2217
|
-
# stream be minimized.
|
|
2218
|
-
#
|
|
2219
|
-
# Defined only for POSIX-compliant systems.
|
|
2220
|
-
#
|
|
2221
|
-
# #### File::NOATIME
|
|
2222
|
-
#
|
|
2223
|
-
# Flag File::NOATIME specifies that act of opening the stream should not modify
|
|
2224
|
-
# its access time (atime).
|
|
2225
|
-
#
|
|
2226
|
-
# Defined only for POSIX-compliant systems.
|
|
2227
|
-
#
|
|
2228
|
-
# #### File::NOFOLLOW
|
|
2229
|
-
#
|
|
2230
|
-
# Flag File::NOFOLLOW specifies that if path is a symbolic link, it should not
|
|
2231
|
-
# be followed.
|
|
2232
|
-
#
|
|
2233
|
-
# Defined only for POSIX-compliant systems.
|
|
2234
|
-
#
|
|
2235
|
-
# #### File::TMPFILE
|
|
2236
|
-
#
|
|
2237
|
-
# Flag File::TMPFILE specifies that the opened stream should be a new temporary
|
|
2238
|
-
# file.
|
|
2239
|
-
#
|
|
2240
|
-
# Defined only for POSIX-compliant systems.
|
|
2241
|
-
#
|
|
2242
|
-
# ### Other File-Access Constants
|
|
2243
|
-
#
|
|
2244
|
-
# #### File::NONBLOCK
|
|
2245
|
-
#
|
|
2246
|
-
# When possible, the file is opened in nonblocking mode. Neither the open
|
|
2247
|
-
# operation nor any subsequent I/O operations on the file will cause the calling
|
|
2248
|
-
# process to wait.
|
|
2249
|
-
#
|
|
2250
|
-
# #### File::BINARY
|
|
2251
|
-
#
|
|
2252
|
-
# Flag File::BINARY specifies that the stream is to be accessed in binary mode.
|
|
2253
|
-
#
|
|
2254
|
-
# #### File::SHARE_DELETE
|
|
2255
|
-
#
|
|
2256
|
-
# Flag File::SHARE_DELETE enables other processes to open the stream with delete
|
|
2257
|
-
# access.
|
|
2258
|
-
#
|
|
2259
|
-
# Windows only.
|
|
2260
|
-
#
|
|
2261
|
-
# If the stream is opened for (local) delete access without File::SHARE_DELETE,
|
|
2262
|
-
# and another process attempts to open it with delete access, the attempt fails
|
|
2263
|
-
# and the stream is not opened for that process.
|
|
2264
|
-
#
|
|
2265
|
-
# ## Locking
|
|
2266
|
-
#
|
|
2267
|
-
# Four file constants relate to stream locking; see File#flock:
|
|
2268
|
-
#
|
|
2269
|
-
# #### File::LOCK_EX
|
|
2270
|
-
#
|
|
2271
|
-
# Flag File::LOCK_EX specifies an exclusive lock; only one process a a time may
|
|
2272
|
-
# lock the stream.
|
|
2273
|
-
#
|
|
2274
|
-
# #### File::LOCK_NB
|
|
2275
|
-
#
|
|
2276
|
-
# Flag File::LOCK_NB specifies non-blocking locking for the stream; may be
|
|
2277
|
-
# combined with File::LOCK_EX or File::LOCK_SH.
|
|
2278
|
-
#
|
|
2279
|
-
# #### File::LOCK_SH
|
|
2280
|
-
#
|
|
2281
|
-
# Flag File::LOCK_SH specifies that multiple processes may lock the stream at
|
|
2282
|
-
# the same time.
|
|
2283
|
-
#
|
|
2284
|
-
# #### File::LOCK_UN
|
|
2285
|
-
#
|
|
2286
|
-
# Flag File::LOCK_UN specifies that the stream is not to be locked.
|
|
2287
|
-
#
|
|
2288
|
-
# ## Filename Globbing Constants (File::FNM_*)
|
|
2289
|
-
#
|
|
2290
|
-
# Filename-globbing constants may be used with optional argument `flags` in
|
|
2291
|
-
# calls to the following methods:
|
|
2292
|
-
#
|
|
2293
|
-
# * Dir.glob.
|
|
2294
|
-
# * File.fnmatch.
|
|
2295
|
-
# * Pathname#fnmatch.
|
|
2296
|
-
# * Pathname.glob.
|
|
2297
|
-
# * Pathname#glob.
|
|
2298
|
-
#
|
|
2299
|
-
# The constants are:
|
|
2300
|
-
#
|
|
2301
|
-
# #### File::FNM_CASEFOLD
|
|
2302
|
-
#
|
|
2303
|
-
# Flag File::FNM_CASEFOLD makes patterns case insensitive for File.fnmatch (but
|
|
2304
|
-
# not Dir.glob).
|
|
2305
|
-
#
|
|
2306
|
-
# #### File::FNM_DOTMATCH
|
|
2307
|
-
#
|
|
2308
|
-
# Flag File::FNM_DOTMATCH makes the <code>'*'</code> pattern match a filename
|
|
2309
|
-
# starting with <code>'.'</code>.
|
|
2310
|
-
#
|
|
2311
|
-
# #### File::FNM_EXTGLOB
|
|
2312
|
-
#
|
|
2313
|
-
# Flag File::FNM_EXTGLOB enables pattern <code>'{_a_,_b_}'</code>, which matches
|
|
2314
|
-
# pattern '*a*' and pattern '*b*'; behaves like a [regexp
|
|
2315
|
-
# union](rdoc-ref:Regexp.union) (e.g., <code>'(?:_a_|_b_)'</code>):
|
|
2316
|
-
#
|
|
2317
|
-
# pattern = '{LEGAL,BSDL}'
|
|
2318
|
-
# Dir.glob(pattern) # => ["LEGAL", "BSDL"]
|
|
2319
|
-
# Pathname.glob(pattern) # => [#<Pathname:LEGAL>, #<Pathname:BSDL>]
|
|
2320
|
-
# pathname.glob(pattern) # => [#<Pathname:LEGAL>, #<Pathname:BSDL>]
|
|
2321
|
-
#
|
|
2322
|
-
# #### File::FNM_NOESCAPE
|
|
2323
|
-
#
|
|
2324
|
-
# Flag File::FNM_NOESCAPE disables <code>'\'</code> escaping.
|
|
2325
|
-
#
|
|
2326
|
-
# #### File::FNM_PATHNAME
|
|
2327
|
-
#
|
|
2328
|
-
# Flag File::FNM_PATHNAME specifies that patterns <code>'*'</code> and
|
|
2329
|
-
# <code>'?'</code> do not match the directory separator (the value of constant
|
|
2330
|
-
# File::SEPARATOR).
|
|
2331
|
-
#
|
|
2332
|
-
# #### File::FNM_SHORTNAME
|
|
2333
|
-
#
|
|
2334
|
-
# Flag File::FNM_SHORTNAME allows patterns to match short names if they exist.
|
|
2335
|
-
#
|
|
2336
|
-
# Windows only.
|
|
2337
|
-
#
|
|
2338
|
-
# #### File::FNM_SYSCASE
|
|
2339
|
-
#
|
|
2340
|
-
# Flag File::FNM_SYSCASE specifies that case sensitivity is the same as in the
|
|
2341
|
-
# underlying operating system; effective for File.fnmatch, but not Dir.glob.
|
|
2342
|
-
#
|
|
2343
|
-
# ## Other Constants
|
|
2344
|
-
#
|
|
2345
|
-
# #### File::NULL
|
|
2346
|
-
#
|
|
2347
|
-
# Flag File::NULL contains the string value of the null device:
|
|
2348
|
-
#
|
|
2349
|
-
# * On a Unix-like OS, <code>'/dev/null'</code>.
|
|
2350
|
-
# * On Windows, <code>'NUL'</code>.
|
|
2351
|
-
#
|
|
2352
|
-
module File::Constants
|
|
2353
|
-
end
|
|
2354
|
-
|
|
2355
|
-
# <!-- rdoc-file=file.c -->
|
|
2356
|
-
# [File::APPEND](rdoc-ref:File::Constants@File-3A-3AAPPEND)
|
|
2357
|
-
#
|
|
2358
|
-
File::Constants::APPEND: Integer
|
|
2359
|
-
|
|
2360
|
-
# <!-- rdoc-file=file.c -->
|
|
2361
|
-
# [File::BINARY](rdoc-ref:File::Constants@File-3A-3ABINARY)
|
|
2362
|
-
#
|
|
2363
|
-
File::Constants::BINARY: Integer
|
|
2364
|
-
|
|
2365
|
-
# <!-- rdoc-file=file.c -->
|
|
2366
|
-
# [File::CREAT](rdoc-ref:File::Constants@File-3A-3ACREAT)
|
|
2367
|
-
#
|
|
2368
|
-
File::Constants::CREAT: Integer
|
|
2369
|
-
|
|
2370
|
-
# <!-- rdoc-file=file.c -->
|
|
2371
|
-
# [File::DIRECT](rdoc-ref:File::Constants@File-3A-3ADIRECT)
|
|
2372
|
-
#
|
|
2373
|
-
File::Constants::DIRECT: Integer
|
|
2374
|
-
|
|
2375
|
-
# <!-- rdoc-file=file.c -->
|
|
2376
|
-
# [File::DSYNC](rdoc-ref:File::Constants@File-3A-3ASYNC-2C+File-3A-3ARSYNC-2C+an
|
|
2377
|
-
# d+File-3A-3ADSYNC)
|
|
2378
|
-
#
|
|
2379
|
-
File::Constants::DSYNC: Integer
|
|
2380
|
-
|
|
2381
|
-
# <!-- rdoc-file=file.c -->
|
|
2382
|
-
# [File::EXCL](rdoc-ref:File::Constants@File-3A-3AEXCL)
|
|
2383
|
-
#
|
|
2384
|
-
File::Constants::EXCL: Integer
|
|
2385
|
-
|
|
2386
|
-
# <!-- rdoc-file=dir.c -->
|
|
2387
|
-
# [File::FNM_CASEFOLD](rdoc-ref:File::Constants@File-3A-3AFNM_CASEFOLD)
|
|
2388
|
-
#
|
|
2389
|
-
File::Constants::FNM_CASEFOLD: Integer
|
|
2390
|
-
|
|
2391
|
-
# <!-- rdoc-file=dir.c -->
|
|
2392
|
-
# [File::FNM_DOTMATCH](rdoc-ref:File::Constants@File-3A-3AFNM_DOTMATCH)
|
|
2393
|
-
#
|
|
2394
|
-
File::Constants::FNM_DOTMATCH: Integer
|
|
2395
|
-
|
|
2396
|
-
# <!-- rdoc-file=dir.c -->
|
|
2397
|
-
# [File::FNM_EXTGLOB](rdoc-ref:File::Constants@File-3A-3AFNM_EXTGLOB)
|
|
2398
|
-
#
|
|
2399
|
-
File::Constants::FNM_EXTGLOB: Integer
|
|
2400
|
-
|
|
2401
|
-
# <!-- rdoc-file=dir.c -->
|
|
2402
|
-
# [File::FNM_NOESCAPE](rdoc-ref:File::Constants@File-3A-3AFNM_NOESCAPE)
|
|
2403
|
-
#
|
|
2404
|
-
File::Constants::FNM_NOESCAPE: Integer
|
|
2405
|
-
|
|
2406
|
-
# <!-- rdoc-file=dir.c -->
|
|
2407
|
-
# [File::FNM_PATHNAME](rdoc-ref:File::Constants@File-3A-3AFNM_PATHNAME)
|
|
2408
|
-
#
|
|
2409
|
-
File::Constants::FNM_PATHNAME: Integer
|
|
2410
|
-
|
|
2411
|
-
# <!-- rdoc-file=dir.c -->
|
|
2412
|
-
# [File::FNM_SHORTNAME](rdoc-ref:File::Constants@File-3A-3AFNM_SHORTNAME)
|
|
2413
|
-
#
|
|
2414
|
-
File::Constants::FNM_SHORTNAME: Integer
|
|
2415
|
-
|
|
2416
|
-
# <!-- rdoc-file=dir.c -->
|
|
2417
|
-
# [File::FNM_SYSCASE](rdoc-ref:File::Constants@File-3A-3AFNM_SYSCASE)
|
|
2418
|
-
#
|
|
2419
|
-
File::Constants::FNM_SYSCASE: Integer
|
|
2420
|
-
|
|
2421
|
-
# <!-- rdoc-file=file.c -->
|
|
2422
|
-
# [File::LOCK_EX](rdoc-ref:File::Constants@File-3A-3ALOCK_EX)
|
|
2423
|
-
#
|
|
2424
|
-
File::Constants::LOCK_EX: Integer
|
|
2425
|
-
|
|
2426
|
-
# <!-- rdoc-file=file.c -->
|
|
2427
|
-
# [File::LOCK_NB](rdoc-ref:File::Constants@File-3A-3ALOCK_NB)
|
|
2428
|
-
#
|
|
2429
|
-
File::Constants::LOCK_NB: Integer
|
|
2430
|
-
|
|
2431
|
-
# <!-- rdoc-file=file.c -->
|
|
2432
|
-
# [File::LOCK_SH](rdoc-ref:File::Constants@File-3A-3ALOCK_SH)
|
|
2433
|
-
#
|
|
2434
|
-
File::Constants::LOCK_SH: Integer
|
|
2435
|
-
|
|
2436
|
-
# <!-- rdoc-file=file.c -->
|
|
2437
|
-
# [File::LOCK_UN](rdoc-ref:File::Constants@File-3A-3ALOCK_UN)
|
|
2438
|
-
#
|
|
2439
|
-
File::Constants::LOCK_UN: Integer
|
|
2440
|
-
|
|
2441
|
-
# <!-- rdoc-file=file.c -->
|
|
2442
|
-
# [File::NOATIME](rdoc-ref:File::Constants@File-3A-3ANOATIME)
|
|
2443
|
-
#
|
|
2444
|
-
File::Constants::NOATIME: Integer
|
|
2445
|
-
|
|
2446
|
-
# <!-- rdoc-file=file.c -->
|
|
2447
|
-
# [File::NOCTTY](rdoc-ref:File::Constants@File-3A-3ANOCTTY)
|
|
2448
|
-
#
|
|
2449
|
-
File::Constants::NOCTTY: Integer
|
|
2450
|
-
|
|
2451
|
-
# <!-- rdoc-file=file.c -->
|
|
2452
|
-
# [File::NOFOLLOW](rdoc-ref:File::Constants@File-3A-3ANOFOLLOW)
|
|
2453
|
-
#
|
|
2454
|
-
File::Constants::NOFOLLOW: Integer
|
|
2455
|
-
|
|
2456
|
-
# <!-- rdoc-file=file.c -->
|
|
2457
|
-
# [File::NONBLOCK](rdoc-ref:File::Constants@File-3A-3ANONBLOCK)
|
|
2458
|
-
#
|
|
2459
|
-
File::Constants::NONBLOCK: Integer
|
|
2460
|
-
|
|
2461
|
-
# <!-- rdoc-file=file.c -->
|
|
2462
|
-
# [File::NULL](rdoc-ref:File::Constants@File-3A-3ANULL)
|
|
2463
|
-
#
|
|
2464
|
-
File::Constants::NULL: String
|
|
2465
|
-
|
|
2466
|
-
# <!-- rdoc-file=file.c -->
|
|
2467
|
-
# [File::RDONLY](rdoc-ref:File::Constants@File-3A-3ARDONLY)
|
|
2468
|
-
#
|
|
2469
|
-
File::Constants::RDONLY: Integer
|
|
2470
|
-
|
|
2471
|
-
# <!-- rdoc-file=file.c -->
|
|
2472
|
-
# [File::RDWR](rdoc-ref:File::Constants@File-3A-3ARDWR)
|
|
2473
|
-
#
|
|
2474
|
-
File::Constants::RDWR: Integer
|
|
2475
|
-
|
|
2476
|
-
# <!-- rdoc-file=file.c -->
|
|
2477
|
-
# [File::RSYNC](rdoc-ref:File::Constants@File-3A-3ASYNC-2C+File-3A-3ARSYNC-2C+an
|
|
2478
|
-
# d+File-3A-3ADSYNC)
|
|
2479
|
-
#
|
|
2480
|
-
File::Constants::RSYNC: Integer
|
|
2481
|
-
|
|
2482
|
-
# <!-- rdoc-file=file.c -->
|
|
2483
|
-
# [File::SHARE_DELETE](rdoc-ref:File::Constants@File-3A-3ASHARE_DELETE)
|
|
2484
|
-
#
|
|
2485
|
-
File::Constants::SHARE_DELETE: Integer
|
|
2486
|
-
|
|
2487
|
-
# <!-- rdoc-file=file.c -->
|
|
2488
|
-
# [File::SYNC](rdoc-ref:File::Constants@File-3A-3ASYNC-2C+File-3A-3ARSYNC-2C+and
|
|
2489
|
-
# +File-3A-3ADSYNC)
|
|
2490
|
-
#
|
|
2491
|
-
File::Constants::SYNC: Integer
|
|
2492
|
-
|
|
2493
|
-
# <!-- rdoc-file=file.c -->
|
|
2494
|
-
# [File::TMPFILE](rdoc-ref:File::Constants@File-3A-3ATMPFILE)
|
|
2495
|
-
#
|
|
2496
|
-
File::Constants::TMPFILE: Integer
|
|
2497
|
-
|
|
2498
|
-
# <!-- rdoc-file=file.c -->
|
|
2499
|
-
# [File::TRUNC](rdoc-ref:File::Constants@File-3A-3ATRUNC)
|
|
2500
|
-
#
|
|
2501
|
-
File::Constants::TRUNC: Integer
|
|
2502
|
-
|
|
2503
|
-
# <!-- rdoc-file=file.c -->
|
|
2504
|
-
# [File::WRONLY](rdoc-ref:File::Constants@File-3A-3AWRONLY)
|
|
2505
|
-
#
|
|
2506
|
-
File::Constants::WRONLY: Integer
|
|
2507
|
-
|
|
2508
|
-
# <!-- rdoc-file=file.c -->
|
|
2509
|
-
# Objects of class File::Stat encapsulate common status information for File
|
|
2510
|
-
# objects. The information is recorded at the moment the File::Stat object is
|
|
2511
|
-
# created; changes made to the file after that point will not be reflected.
|
|
2512
|
-
# File::Stat objects are returned by IO#stat, File::stat, File#lstat, and
|
|
2513
|
-
# File::lstat. Many of these methods return platform-specific values, and not
|
|
2514
|
-
# all values are meaningful on all systems. See also Kernel#test.
|
|
2515
|
-
#
|
|
2516
|
-
class File::Stat < Object
|
|
2517
|
-
include Comparable
|
|
2518
|
-
|
|
2519
|
-
# <!--
|
|
2520
|
-
# rdoc-file=file.c
|
|
2521
|
-
# - File::Stat.new(file_name) -> stat
|
|
2522
|
-
# -->
|
|
2523
|
-
# Create a File::Stat object for the given file name (raising an exception if
|
|
2524
|
-
# the file doesn't exist).
|
|
2525
|
-
#
|
|
2526
|
-
def initialize: (String file) -> void
|
|
2527
|
-
|
|
2528
|
-
# <!--
|
|
2529
|
-
# rdoc-file=file.c
|
|
2530
|
-
# - self <=> other -> -1, 0, 1, or nil
|
|
2531
|
-
# -->
|
|
2532
|
-
# Compares `self` and `other`, by comparing their modification times; that is,
|
|
2533
|
-
# by comparing <code>self.mtime</code> and <code>other.mtime</code>.
|
|
2534
|
-
#
|
|
2535
|
-
# Returns:
|
|
2536
|
-
#
|
|
2537
|
-
# * <code>-1</code>, if <code>self.mtime</code> is earlier.
|
|
2538
|
-
# * `0`, if the two values are equal.
|
|
2539
|
-
# * `1`, if <code>self.mtime</code> is later.
|
|
2540
|
-
# * `nil`, if `other` is not a File::Stat object.
|
|
2541
|
-
#
|
|
2542
|
-
# Examples:
|
|
2543
|
-
#
|
|
2544
|
-
# stat0 = File.stat('README.md')
|
|
2545
|
-
# stat1 = File.stat('NEWS.md')
|
|
2546
|
-
# stat0.mtime # => 2025-12-20 15:33:05.6972341 -0600
|
|
2547
|
-
# stat1.mtime # => 2025-12-20 16:02:08.2672945 -0600
|
|
2548
|
-
# stat0 <=> stat1 # => -1
|
|
2549
|
-
# stat0 <=> stat0.dup # => 0
|
|
2550
|
-
# stat1 <=> stat0 # => 1
|
|
2551
|
-
# stat0 <=> :foo # => nil
|
|
2552
|
-
#
|
|
2553
|
-
# Class File::Stat includes module Comparable, each of whose methods uses
|
|
2554
|
-
# File::Stat#<=> for comparison.
|
|
2555
|
-
#
|
|
2556
|
-
def <=>: (File::Stat other) -> Integer
|
|
2557
|
-
| (untyped) -> nil
|
|
2558
|
-
|
|
2559
|
-
# <!--
|
|
2560
|
-
# rdoc-file=file.c
|
|
2561
|
-
# - stat.atime -> time
|
|
2562
|
-
# -->
|
|
2563
|
-
# Returns the last access time for this file as an object of class Time.
|
|
2564
|
-
#
|
|
2565
|
-
# File.stat("testfile").atime #=> Wed Dec 31 18:00:00 CST 1969
|
|
2566
|
-
#
|
|
2567
|
-
def atime: () -> Time
|
|
2568
|
-
|
|
2569
|
-
# <!--
|
|
2570
|
-
# rdoc-file=file.c
|
|
2571
|
-
# - stat.birthtime -> time
|
|
2572
|
-
# -->
|
|
2573
|
-
# Returns the birth time for *stat*.
|
|
2574
|
-
#
|
|
2575
|
-
# If the platform doesn't have birthtime, raises NotImplementedError.
|
|
2576
|
-
#
|
|
2577
|
-
# File.write("testfile", "foo")
|
|
2578
|
-
# sleep 10
|
|
2579
|
-
# File.write("testfile", "bar")
|
|
2580
|
-
# sleep 10
|
|
2581
|
-
# File.chmod(0644, "testfile")
|
|
2582
|
-
# sleep 10
|
|
2583
|
-
# File.read("testfile")
|
|
2584
|
-
# File.stat("testfile").birthtime #=> 2014-02-24 11:19:17 +0900
|
|
2585
|
-
# File.stat("testfile").mtime #=> 2014-02-24 11:19:27 +0900
|
|
2586
|
-
# File.stat("testfile").ctime #=> 2014-02-24 11:19:37 +0900
|
|
2587
|
-
# File.stat("testfile").atime #=> 2014-02-24 11:19:47 +0900
|
|
2588
|
-
#
|
|
2589
|
-
def birthtime: () -> Time
|
|
2590
|
-
|
|
2591
|
-
# <!--
|
|
2592
|
-
# rdoc-file=file.c
|
|
2593
|
-
# - stat.blksize -> integer or nil
|
|
2594
|
-
# -->
|
|
2595
|
-
# Returns the native file system's block size. Will return `nil` on platforms
|
|
2596
|
-
# that don't support this information.
|
|
2597
|
-
#
|
|
2598
|
-
# File.stat("testfile").blksize #=> 4096
|
|
2599
|
-
#
|
|
2600
|
-
def blksize: () -> Integer?
|
|
2601
|
-
|
|
2602
|
-
# <!--
|
|
2603
|
-
# rdoc-file=file.c
|
|
2604
|
-
# - stat.blockdev? -> true or false
|
|
2605
|
-
# -->
|
|
2606
|
-
# Returns `true` if the file is a block device, `false` if it isn't or if the
|
|
2607
|
-
# operating system doesn't support this feature.
|
|
2608
|
-
#
|
|
2609
|
-
# File.stat("testfile").blockdev? #=> false
|
|
2610
|
-
# File.stat("/dev/hda1").blockdev? #=> true
|
|
2611
|
-
#
|
|
2612
|
-
def blockdev?: () -> bool
|
|
2613
|
-
|
|
2614
|
-
# <!--
|
|
2615
|
-
# rdoc-file=file.c
|
|
2616
|
-
# - stat.blocks -> integer or nil
|
|
2617
|
-
# -->
|
|
2618
|
-
# Returns the number of native file system blocks allocated for this file, or
|
|
2619
|
-
# `nil` if the operating system doesn't support this feature.
|
|
2620
|
-
#
|
|
2621
|
-
# File.stat("testfile").blocks #=> 2
|
|
2622
|
-
#
|
|
2623
|
-
def blocks: () -> Integer?
|
|
2624
|
-
|
|
2625
|
-
# <!--
|
|
2626
|
-
# rdoc-file=file.c
|
|
2627
|
-
# - stat.chardev? -> true or false
|
|
2628
|
-
# -->
|
|
2629
|
-
# Returns `true` if the file is a character device, `false` if it isn't or if
|
|
2630
|
-
# the operating system doesn't support this feature.
|
|
2631
|
-
#
|
|
2632
|
-
# File.stat("/dev/tty").chardev? #=> true
|
|
2633
|
-
#
|
|
2634
|
-
def chardev?: () -> bool
|
|
2635
|
-
|
|
2636
|
-
# <!--
|
|
2637
|
-
# rdoc-file=file.c
|
|
2638
|
-
# - stat.ctime -> time
|
|
2639
|
-
# -->
|
|
2640
|
-
# Returns the change time for *stat* (that is, the time directory information
|
|
2641
|
-
# about the file was changed, not the file itself).
|
|
2642
|
-
#
|
|
2643
|
-
# Note that on Windows (NTFS), returns creation time (birth time).
|
|
2644
|
-
#
|
|
2645
|
-
# File.stat("testfile").ctime #=> Wed Apr 09 08:53:14 CDT 2003
|
|
2646
|
-
#
|
|
2647
|
-
def ctime: () -> Time
|
|
2648
|
-
|
|
2649
|
-
# <!--
|
|
2650
|
-
# rdoc-file=file.c
|
|
2651
|
-
# - stat.dev -> integer
|
|
2652
|
-
# -->
|
|
2653
|
-
# Returns an integer representing the device on which *stat* resides.
|
|
2654
|
-
#
|
|
2655
|
-
# File.stat("testfile").dev #=> 774
|
|
2656
|
-
#
|
|
2657
|
-
def dev: () -> Integer
|
|
2658
|
-
|
|
2659
|
-
# <!--
|
|
2660
|
-
# rdoc-file=file.c
|
|
2661
|
-
# - stat.dev_major -> integer
|
|
2662
|
-
# -->
|
|
2663
|
-
# Returns the major part of <code>File_Stat#dev</code> or `nil`.
|
|
2664
|
-
#
|
|
2665
|
-
# File.stat("/dev/fd1").dev_major #=> 2
|
|
2666
|
-
# File.stat("/dev/tty").dev_major #=> 5
|
|
2667
|
-
#
|
|
2668
|
-
def dev_major: () -> Integer
|
|
2669
|
-
|
|
2670
|
-
# <!--
|
|
2671
|
-
# rdoc-file=file.c
|
|
2672
|
-
# - stat.dev_minor -> integer
|
|
2673
|
-
# -->
|
|
2674
|
-
# Returns the minor part of <code>File_Stat#dev</code> or `nil`.
|
|
2675
|
-
#
|
|
2676
|
-
# File.stat("/dev/fd1").dev_minor #=> 1
|
|
2677
|
-
# File.stat("/dev/tty").dev_minor #=> 0
|
|
2678
|
-
#
|
|
2679
|
-
def dev_minor: () -> Integer
|
|
2680
|
-
|
|
2681
|
-
# <!--
|
|
2682
|
-
# rdoc-file=file.c
|
|
2683
|
-
# - stat.directory? -> true or false
|
|
2684
|
-
# -->
|
|
2685
|
-
# Returns `true` if *stat* is a directory, `false` otherwise.
|
|
2686
|
-
#
|
|
2687
|
-
# File.stat("testfile").directory? #=> false
|
|
2688
|
-
# File.stat(".").directory? #=> true
|
|
2689
|
-
#
|
|
2690
|
-
def directory?: () -> bool
|
|
2691
|
-
|
|
2692
|
-
# <!--
|
|
2693
|
-
# rdoc-file=file.c
|
|
2694
|
-
# - stat.executable? -> true or false
|
|
2695
|
-
# -->
|
|
2696
|
-
# Returns `true` if *stat* is executable or if the operating system doesn't
|
|
2697
|
-
# distinguish executable files from nonexecutable files. The tests are made
|
|
2698
|
-
# using the effective owner of the process.
|
|
2699
|
-
#
|
|
2700
|
-
# File.stat("testfile").executable? #=> false
|
|
2701
|
-
#
|
|
2702
|
-
def executable?: () -> bool
|
|
2703
|
-
|
|
2704
|
-
# <!--
|
|
2705
|
-
# rdoc-file=file.c
|
|
2706
|
-
# - stat.executable_real? -> true or false
|
|
2707
|
-
# -->
|
|
2708
|
-
# Same as <code>executable?</code>, but tests using the real owner of the
|
|
2709
|
-
# process.
|
|
2710
|
-
#
|
|
2711
|
-
def executable_real?: () -> bool
|
|
2712
|
-
|
|
2713
|
-
# <!--
|
|
2714
|
-
# rdoc-file=file.c
|
|
2715
|
-
# - stat.file? -> true or false
|
|
2716
|
-
# -->
|
|
2717
|
-
# Returns `true` if *stat* is a regular file (not a device file, pipe, socket,
|
|
2718
|
-
# etc.).
|
|
2719
|
-
#
|
|
2720
|
-
# File.stat("testfile").file? #=> true
|
|
2721
|
-
#
|
|
2722
|
-
def file?: () -> bool
|
|
2723
|
-
|
|
2724
|
-
# <!--
|
|
2725
|
-
# rdoc-file=file.c
|
|
2726
|
-
# - stat.ftype -> string
|
|
2727
|
-
# -->
|
|
2728
|
-
# Identifies the type of *stat*. The return string is one of: ```file`'',
|
|
2729
|
-
# ```directory`'', ```characterSpecial`'', ```blockSpecial`'', ```fifo`'',
|
|
2730
|
-
# ```link`'', ```socket`'', or ```unknown`''.
|
|
2731
|
-
#
|
|
2732
|
-
# File.stat("/dev/tty").ftype #=> "characterSpecial"
|
|
2733
|
-
#
|
|
2734
|
-
def ftype: () -> String
|
|
2735
|
-
|
|
2736
|
-
# <!--
|
|
2737
|
-
# rdoc-file=file.c
|
|
2738
|
-
# - stat.gid -> integer
|
|
2739
|
-
# -->
|
|
2740
|
-
# Returns the numeric group id of the owner of *stat*.
|
|
2741
|
-
#
|
|
2742
|
-
# File.stat("testfile").gid #=> 500
|
|
2743
|
-
#
|
|
2744
|
-
def gid: () -> Integer
|
|
2745
|
-
|
|
2746
|
-
# <!--
|
|
2747
|
-
# rdoc-file=file.c
|
|
2748
|
-
# - stat.grpowned? -> true or false
|
|
2749
|
-
# -->
|
|
2750
|
-
# Returns true if the effective group id of the process is the same as the group
|
|
2751
|
-
# id of *stat*. On Windows, returns `false`.
|
|
2752
|
-
#
|
|
2753
|
-
# File.stat("testfile").grpowned? #=> true
|
|
2754
|
-
# File.stat("/etc/passwd").grpowned? #=> false
|
|
2755
|
-
#
|
|
2756
|
-
def grpowned?: () -> bool
|
|
2757
|
-
|
|
2758
|
-
# <!--
|
|
2759
|
-
# rdoc-file=file.c
|
|
2760
|
-
# - stat.ino -> integer
|
|
2761
|
-
# -->
|
|
2762
|
-
# Returns the inode number for *stat*.
|
|
2763
|
-
#
|
|
2764
|
-
# File.stat("testfile").ino #=> 1083669
|
|
2765
|
-
#
|
|
2766
|
-
def ino: () -> Integer
|
|
2767
|
-
|
|
2768
|
-
# <!--
|
|
2769
|
-
# rdoc-file=file.c
|
|
2770
|
-
# - stat.inspect -> string
|
|
2771
|
-
# -->
|
|
2772
|
-
# Produce a nicely formatted description of *stat*.
|
|
2773
|
-
#
|
|
2774
|
-
# File.stat("/etc/passwd").inspect
|
|
2775
|
-
# #=> "#<File::Stat dev=0xe000005, ino=1078078, mode=0100644,
|
|
2776
|
-
# # nlink=1, uid=0, gid=0, rdev=0x0, size=1374, blksize=4096,
|
|
2777
|
-
# # blocks=8, atime=Wed Dec 10 10:16:12 CST 2003,
|
|
2778
|
-
# # mtime=Fri Sep 12 15:41:41 CDT 2003,
|
|
2779
|
-
# # ctime=Mon Oct 27 11:20:27 CST 2003,
|
|
2780
|
-
# # birthtime=Mon Aug 04 08:13:49 CDT 2003>"
|
|
2781
|
-
#
|
|
2782
|
-
def inspect: () -> String
|
|
2783
|
-
|
|
2784
|
-
# <!--
|
|
2785
|
-
# rdoc-file=file.c
|
|
2786
|
-
# - stat.mode -> integer
|
|
2787
|
-
# -->
|
|
2788
|
-
# Returns an integer representing the permission bits of *stat*. The meaning of
|
|
2789
|
-
# the bits is platform dependent; on Unix systems, see <code>stat(2)</code>.
|
|
2790
|
-
#
|
|
2791
|
-
# File.chmod(0644, "testfile") #=> 1
|
|
2792
|
-
# s = File.stat("testfile")
|
|
2793
|
-
# sprintf("%o", s.mode) #=> "100644"
|
|
2794
|
-
#
|
|
2795
|
-
def mode: () -> Integer
|
|
2796
|
-
|
|
2797
|
-
# <!--
|
|
2798
|
-
# rdoc-file=file.c
|
|
2799
|
-
# - stat.mtime -> time
|
|
2800
|
-
# -->
|
|
2801
|
-
# Returns the modification time of *stat*.
|
|
2802
|
-
#
|
|
2803
|
-
# File.stat("testfile").mtime #=> Wed Apr 09 08:53:14 CDT 2003
|
|
2804
|
-
#
|
|
2805
|
-
def mtime: () -> Time
|
|
2806
|
-
|
|
2807
|
-
# <!--
|
|
2808
|
-
# rdoc-file=file.c
|
|
2809
|
-
# - stat.nlink -> integer
|
|
2810
|
-
# -->
|
|
2811
|
-
# Returns the number of hard links to *stat*.
|
|
2812
|
-
#
|
|
2813
|
-
# File.stat("testfile").nlink #=> 1
|
|
2814
|
-
# File.link("testfile", "testfile.bak") #=> 0
|
|
2815
|
-
# File.stat("testfile").nlink #=> 2
|
|
2816
|
-
#
|
|
2817
|
-
def nlink: () -> Integer
|
|
2818
|
-
|
|
2819
|
-
# <!--
|
|
2820
|
-
# rdoc-file=file.c
|
|
2821
|
-
# - stat.owned? -> true or false
|
|
2822
|
-
# -->
|
|
2823
|
-
# Returns `true` if the effective user id of the process is the same as the
|
|
2824
|
-
# owner of *stat*.
|
|
2825
|
-
#
|
|
2826
|
-
# File.stat("testfile").owned? #=> true
|
|
2827
|
-
# File.stat("/etc/passwd").owned? #=> false
|
|
2828
|
-
#
|
|
2829
|
-
def owned?: () -> bool
|
|
2830
|
-
|
|
2831
|
-
# <!--
|
|
2832
|
-
# rdoc-file=file.c
|
|
2833
|
-
# - stat.pipe? -> true or false
|
|
2834
|
-
# -->
|
|
2835
|
-
# Returns `true` if the operating system supports pipes and *stat* is a pipe;
|
|
2836
|
-
# `false` otherwise.
|
|
2837
|
-
#
|
|
2838
|
-
def pipe?: () -> bool
|
|
2839
|
-
|
|
2840
|
-
# <!--
|
|
2841
|
-
# rdoc-file=file.c
|
|
2842
|
-
# - stat.rdev -> integer or nil
|
|
2843
|
-
# -->
|
|
2844
|
-
# Returns an integer representing the device type on which *stat* resides.
|
|
2845
|
-
# Returns `nil` if the operating system doesn't support this feature.
|
|
2846
|
-
#
|
|
2847
|
-
# File.stat("/dev/fd1").rdev #=> 513
|
|
2848
|
-
# File.stat("/dev/tty").rdev #=> 1280
|
|
2849
|
-
#
|
|
2850
|
-
def rdev: () -> Integer?
|
|
2851
|
-
|
|
2852
|
-
# <!--
|
|
2853
|
-
# rdoc-file=file.c
|
|
2854
|
-
# - stat.rdev_major -> integer
|
|
2855
|
-
# -->
|
|
2856
|
-
# Returns the major part of <code>File_Stat#rdev</code> or `nil`.
|
|
2857
|
-
#
|
|
2858
|
-
# File.stat("/dev/fd1").rdev_major #=> 2
|
|
2859
|
-
# File.stat("/dev/tty").rdev_major #=> 5
|
|
2860
|
-
#
|
|
2861
|
-
def rdev_major: () -> Integer
|
|
2862
|
-
|
|
2863
|
-
# <!--
|
|
2864
|
-
# rdoc-file=file.c
|
|
2865
|
-
# - stat.rdev_minor -> integer
|
|
2866
|
-
# -->
|
|
2867
|
-
# Returns the minor part of <code>File_Stat#rdev</code> or `nil`.
|
|
2868
|
-
#
|
|
2869
|
-
# File.stat("/dev/fd1").rdev_minor #=> 1
|
|
2870
|
-
# File.stat("/dev/tty").rdev_minor #=> 0
|
|
2871
|
-
#
|
|
2872
|
-
def rdev_minor: () -> Integer
|
|
2873
|
-
|
|
2874
|
-
# <!--
|
|
2875
|
-
# rdoc-file=file.c
|
|
2876
|
-
# - stat.readable? -> true or false
|
|
2877
|
-
# -->
|
|
2878
|
-
# Returns `true` if *stat* is readable by the effective user id of this process.
|
|
2879
|
-
#
|
|
2880
|
-
# File.stat("testfile").readable? #=> true
|
|
2881
|
-
#
|
|
2882
|
-
def readable?: () -> bool
|
|
2883
|
-
|
|
2884
|
-
# <!--
|
|
2885
|
-
# rdoc-file=file.c
|
|
2886
|
-
# - stat.readable_real? -> true or false
|
|
2887
|
-
# -->
|
|
2888
|
-
# Returns `true` if *stat* is readable by the real user id of this process.
|
|
2889
|
-
#
|
|
2890
|
-
# File.stat("testfile").readable_real? #=> true
|
|
2891
|
-
#
|
|
2892
|
-
def readable_real?: () -> bool
|
|
2893
|
-
|
|
2894
|
-
# <!--
|
|
2895
|
-
# rdoc-file=file.c
|
|
2896
|
-
# - stat.setgid? -> true or false
|
|
2897
|
-
# -->
|
|
2898
|
-
# Returns `true` if *stat* has the set-group-id permission bit set, `false` if
|
|
2899
|
-
# it doesn't or if the operating system doesn't support this feature.
|
|
2900
|
-
#
|
|
2901
|
-
# File.stat("/usr/sbin/lpc").setgid? #=> true
|
|
2902
|
-
#
|
|
2903
|
-
def setgid?: () -> bool
|
|
2904
|
-
|
|
2905
|
-
# <!--
|
|
2906
|
-
# rdoc-file=file.c
|
|
2907
|
-
# - stat.setuid? -> true or false
|
|
2908
|
-
# -->
|
|
2909
|
-
# Returns `true` if *stat* has the set-user-id permission bit set, `false` if it
|
|
2910
|
-
# doesn't or if the operating system doesn't support this feature.
|
|
2911
|
-
#
|
|
2912
|
-
# File.stat("/bin/su").setuid? #=> true
|
|
2913
|
-
#
|
|
2914
|
-
def setuid?: () -> bool
|
|
2915
|
-
|
|
2916
|
-
# <!--
|
|
2917
|
-
# rdoc-file=file.c
|
|
2918
|
-
# - stat.size -> integer
|
|
2919
|
-
# -->
|
|
2920
|
-
# Returns the size of *stat* in bytes.
|
|
2921
|
-
#
|
|
2922
|
-
# File.stat("testfile").size #=> 66
|
|
2923
|
-
#
|
|
2924
|
-
def size: () -> Integer
|
|
2925
|
-
|
|
2926
|
-
# <!--
|
|
2927
|
-
# rdoc-file=file.c
|
|
2928
|
-
# - stat.size? -> Integer or nil
|
|
2929
|
-
# -->
|
|
2930
|
-
# Returns `nil` if *stat* is a zero-length file, the size of the file otherwise.
|
|
2931
|
-
#
|
|
2932
|
-
# File.stat("testfile").size? #=> 66
|
|
2933
|
-
# File.stat(File::NULL).size? #=> nil
|
|
2934
|
-
#
|
|
2935
|
-
def size?: () -> Integer?
|
|
2936
|
-
|
|
2937
|
-
# <!--
|
|
2938
|
-
# rdoc-file=file.c
|
|
2939
|
-
# - stat.socket? -> true or false
|
|
2940
|
-
# -->
|
|
2941
|
-
# Returns `true` if *stat* is a socket, `false` if it isn't or if the operating
|
|
2942
|
-
# system doesn't support this feature.
|
|
2943
|
-
#
|
|
2944
|
-
# File.stat("testfile").socket? #=> false
|
|
2945
|
-
#
|
|
2946
|
-
def socket?: () -> bool
|
|
2947
|
-
|
|
2948
|
-
# <!--
|
|
2949
|
-
# rdoc-file=file.c
|
|
2950
|
-
# - stat.sticky? -> true or false
|
|
2951
|
-
# -->
|
|
2952
|
-
# Returns `true` if *stat* has its sticky bit set, `false` if it doesn't or if
|
|
2953
|
-
# the operating system doesn't support this feature.
|
|
2954
|
-
#
|
|
2955
|
-
# File.stat("testfile").sticky? #=> false
|
|
2956
|
-
#
|
|
2957
|
-
def sticky?: () -> bool
|
|
2958
|
-
|
|
2959
|
-
# <!--
|
|
2960
|
-
# rdoc-file=file.c
|
|
2961
|
-
# - stat.symlink? -> true or false
|
|
2962
|
-
# -->
|
|
2963
|
-
# Returns `true` if *stat* is a symbolic link, `false` if it isn't or if the
|
|
2964
|
-
# operating system doesn't support this feature. As File::stat automatically
|
|
2965
|
-
# follows symbolic links, #symlink? will always be `false` for an object
|
|
2966
|
-
# returned by File::stat.
|
|
2967
|
-
#
|
|
2968
|
-
# File.symlink("testfile", "alink") #=> 0
|
|
2969
|
-
# File.stat("alink").symlink? #=> false
|
|
2970
|
-
# File.lstat("alink").symlink? #=> true
|
|
2971
|
-
#
|
|
2972
|
-
def symlink?: () -> bool
|
|
2973
|
-
|
|
2974
|
-
# <!--
|
|
2975
|
-
# rdoc-file=file.c
|
|
2976
|
-
# - stat.uid -> integer
|
|
2977
|
-
# -->
|
|
2978
|
-
# Returns the numeric user id of the owner of *stat*.
|
|
2979
|
-
#
|
|
2980
|
-
# File.stat("testfile").uid #=> 501
|
|
2981
|
-
#
|
|
2982
|
-
def uid: () -> Integer
|
|
2983
|
-
|
|
2984
|
-
# <!--
|
|
2985
|
-
# rdoc-file=file.c
|
|
2986
|
-
# - stat.world_readable? -> integer or nil
|
|
2987
|
-
# -->
|
|
2988
|
-
# If *stat* is readable by others, returns an integer representing the file
|
|
2989
|
-
# permission bits of *stat*. Returns `nil` otherwise. The meaning of the bits is
|
|
2990
|
-
# platform dependent; on Unix systems, see <code>stat(2)</code>.
|
|
2991
|
-
#
|
|
2992
|
-
# m = File.stat("/etc/passwd").world_readable? #=> 420
|
|
2993
|
-
# sprintf("%o", m) #=> "644"
|
|
2994
|
-
#
|
|
2995
|
-
def world_readable?: () -> Integer?
|
|
2996
|
-
|
|
2997
|
-
# <!--
|
|
2998
|
-
# rdoc-file=file.c
|
|
2999
|
-
# - stat.world_writable? -> integer or nil
|
|
3000
|
-
# -->
|
|
3001
|
-
# If *stat* is writable by others, returns an integer representing the file
|
|
3002
|
-
# permission bits of *stat*. Returns `nil` otherwise. The meaning of the bits is
|
|
3003
|
-
# platform dependent; on Unix systems, see <code>stat(2)</code>.
|
|
3004
|
-
#
|
|
3005
|
-
# m = File.stat("/tmp").world_writable? #=> 511
|
|
3006
|
-
# sprintf("%o", m) #=> "777"
|
|
3007
|
-
#
|
|
3008
|
-
def world_writable?: () -> Integer?
|
|
3009
|
-
|
|
3010
|
-
# <!--
|
|
3011
|
-
# rdoc-file=file.c
|
|
3012
|
-
# - stat.writable? -> true or false
|
|
3013
|
-
# -->
|
|
3014
|
-
# Returns `true` if *stat* is writable by the effective user id of this process.
|
|
3015
|
-
#
|
|
3016
|
-
# File.stat("testfile").writable? #=> true
|
|
3017
|
-
#
|
|
3018
|
-
def writable?: () -> bool
|
|
3019
|
-
|
|
3020
|
-
# <!--
|
|
3021
|
-
# rdoc-file=file.c
|
|
3022
|
-
# - stat.writable_real? -> true or false
|
|
3023
|
-
# -->
|
|
3024
|
-
# Returns `true` if *stat* is writable by the real user id of this process.
|
|
3025
|
-
#
|
|
3026
|
-
# File.stat("testfile").writable_real? #=> true
|
|
3027
|
-
#
|
|
3028
|
-
def writable_real?: () -> bool
|
|
3029
|
-
|
|
3030
|
-
# <!--
|
|
3031
|
-
# rdoc-file=file.c
|
|
3032
|
-
# - stat.zero? -> true or false
|
|
3033
|
-
# -->
|
|
3034
|
-
# Returns `true` if *stat* is a zero-length file; `false` otherwise.
|
|
3035
|
-
#
|
|
3036
|
-
# File.stat("testfile").zero? #=> false
|
|
3037
|
-
#
|
|
3038
|
-
def zero?: () -> bool
|
|
3039
|
-
end
|