種類
- モジュール関数 (433)
- インスタンスメソッド (409)
- 特異メソッド (211)
- クラス (11)
- モジュール (11)
ライブラリ
- ビルトイン (1075)
クラス
-
ARGF
. class (110) - Binding (6)
- Dir (11)
- Exception (29)
- File (154)
- IO (95)
- Method (10)
- Module (5)
-
ObjectSpace
:: WeakMap (11) - String (79)
- Thread (22)
- TracePoint (22)
オブジェクト
- ENV (44)
キーワード
- FileTest (11)
- Proc (11)
- []= (11)
- atime (11)
-
backtrace
_ locations (33) - binmode (11)
- blockdev? (11)
-
caller
_ locations (22) - chardev? (11)
- chomp (11)
- chop (11)
- chown (11)
- chr (11)
- clone (11)
- close (11)
- closed? (11)
-
const
_ source _ location (5) - ctime (22)
- delete (33)
- directory? (11)
- dup (11)
-
each
_ char (22) -
each
_ codepoint (22) - empty? (8)
- encoding (11)
- executable? (11)
-
executable
_ real? (11) - exist? (11)
- exists? (9)
- fdatasync (11)
- file? (11)
- flush (11)
- getc (11)
- gets (33)
- grpowned? (11)
- gsub (33)
- hash (11)
- identical? (11)
-
inplace
_ mode (11) - inspect (16)
-
internal
_ encoding (11) - lambda (17)
-
latest
_ gc _ info (22) - lchmod (11)
- lchown (11)
- length (11)
- link (11)
- mtime (11)
- new (35)
- open (22)
- owned? (11)
- path (11)
- pipe? (11)
- proc (18)
- puts (11)
- read (11)
- readable? (11)
-
readable
_ real? (11) - readlink (11)
- reject (22)
-
set
_ backtrace (11) - setgid? (11)
- setuid? (11)
- size (22)
- size? (11)
- socket? (11)
-
source
_ location (6) - sticky? (11)
- symlink? (11)
-
to
_ s (5) - unlink (11)
- warn (7)
-
world
_ readable? (11) -
world
_ writable? (11) - writable? (11)
-
writable
_ real? (11) - write (7)
- zero? (11)
検索結果
先頭5件
-
Kernel
. # test(cmd , file) -> bool | Time | Integer | nil (26129.0) -
単体のファイルでファイルテストを行います。
...me
: ?A
ファイルの最終アクセス時刻を返す -> Time
: ?C
ファイルの inode 変更時刻を返す -> Time
//emlist[例][ruby]{
IO.write("testfile", "test")
test("r", "testfile") # => true
test("s", "testfile") # => 4
test("M", "testfile") # => 2018-03-31 07:38:40 +0900
//}... -
Kernel
. # test(cmd , file1 , file2) -> bool (26124.0) -
2ファイル間のファイルテストを行います。
...ァイル1とファイル2が同一のファイルである
//emlist[例][ruby]{
IO.write("testfile1", "test1")
IO.write("testfile2", "test2")
%w(= < > -).each do |e|
result = test(e, "testfile1", "testfile2")
puts "#{e}: #{result}"
end
//}
# => =: true
# => <: false
# => >: false
# => -: fals... -
GC
. latest _ gc _ info(key) -> object (14100.0) -
最新のGCの情報を返します。
...す。
//emlist[例][ruby]{
latest = GC.latest_gc_info
latest # => {:major_by=>nil, :gc_by=>:newobj, :have_finalizer=>false, :immediate_sweep=>false, :state=>:sweeping}
stat = GC.stat
merged = GC.latest_gc_info(stat)
merged == latest.merge(stat) # => true
GC.latest_gc_info(:gc_by) # => :newobj... -
GC
. latest _ gc _ info(result _ hash = {}) -> Hash (14100.0) -
最新のGCの情報を返します。
...す。
//emlist[例][ruby]{
latest = GC.latest_gc_info
latest # => {:major_by=>nil, :gc_by=>:newobj, :have_finalizer=>false, :immediate_sweep=>false, :state=>:sweeping}
stat = GC.stat
merged = GC.latest_gc_info(stat)
merged == latest.merge(stat) # => true
GC.latest_gc_info(:gc_by) # => :newobj... -
FileTest (14000.0)
-
ファイルの検査関数を集めたモジュールです。
...ファイルの検査関数を集めたモジュールです。
=== 注意
FileTest で定義された各メソッドは、システムコールに失敗しても例外を発生させません。
真を返した時のみ、返り値は意味をもちます。
例えば、
File.exist?('/root/.bash... -
FileTest
. # identical?(file1 , file2) -> bool (11006.0) -
file1 と file2 が同じファイルを指している時に真を返します。 そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。
...存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。
ruby 1.8.3 以前ではKernel.#test(?-, file1, file2)を使ってください。
open("a", "w") {}
p File.identical?("a", "a") #=> true
p File.identical?("a", "./a") #=... -
FileTest
. # size?(file) -> Integer | nil (11006.0) -
ファイルのサイズを返します。ファイルが存在しない時や ファイルのサイズが0の時には nil を返します。
...定された IO オブジェクト file が既に close されていた場合に発生します。
//emlist[例][ruby]{
IO.write("testfile", "test")
FileTest.size?("testfile") # => 4
File.delete("testfile")
FileTest.size?("testfile") # => nil
//}
@see FileTest.#size, FileTest.#zero?... -
FileTest
. # socket?(file) -> bool (11006.0) -
ファイルがソケットである時に真を返します。そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。
...が既に close されていた場合に発生します。
//emlist[例][ruby]{
require "socket"
IO.write("testfile", "test")
p FileTest.socket?("testfile") # => false
Socket.unix_server_socket('testsock') { p FileTest.socket?('testsock') } # => true
//}... -
FileTest
. # symlink?(file) -> bool (11006.0) -
ファイルがシンボリックリンクである時に真を返します。そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。
...た場合などには false を返します。
@param file ファイル名を表す文字列を指定します。
//emlist[例][ruby]{
IO.write("testfile", "test")
FileTest.symlink?("testfile") # => false
File.symlink("testfile", "testlink")
FileTest.symlink?("testlink") # => true
//}... -
FileTest
. # writable?(file) -> bool (11006.0) -
ファイルがカレントプロセスにより書き込み可能である時に真を返します。そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。
...false を返します。
@param file ファイル名を表す文字列を指定します。
//emlist[例][ruby]{
IO.write("testfile", "test")
File.chmod(0600, "testfile")
FileTest.writable?("testfile") # => true
File.chmod(0400, "testfile")
FileTest.writable?("testfile") # => false
//}...