るりまサーチ

最速Rubyリファレンスマニュアル検索!
318件ヒット [101-200件を表示] (0.056秒)
トップページ > クエリ:file[x] > モジュール:FileTest[x]

別のキーワード

  1. _builtin file?
  2. _builtin file
  3. file path
  4. file open
  5. file size

ライブラリ

キーワード

検索結果

<< < 1 2 3 4 > >>

FileTest.#exist?(file) -> bool (3120.0)

ファイルが存在する時に真を返します。そうでない場合、あるいはシステムコールに失敗した場合などには false を返します。

...m file ファイル名を表す文字列か IO オブジェクトを指定します。

@raise IOError 指定された IO オブジェクト file が既に close されていた場合に発生します。

例:
FileTest
.exist?('/etc/passwd') # => true
FileTest
.exist?('/etc') # => true
FileTest
...
....exist?('/etc/no_such_file') # => false
FileTest
.exist?('/etc/no_such_directory') # => false...

FileTest.#readable?(file) -> bool (3120.0)

ファイルがカレントプロセスにより読み込み可能な時に真を返します。そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。

...は false を返します。

@param file ファイル名を表す文字列を指定します。

//emlist[例][ruby]{
IO.write("testfile", "")
File
.chmod(0644, "testfile")
FileTest
.readable?("testfile") # => true
File
.chmod(0200, "testfile")
FileTest
.readable?("testfile") # => false
//}...

FileTest.#size(file) -> Integer (3120.0)

ファイルのサイズを返します。

...す。

@param file ファイル名を表す文字列か IO オブジェクトを指定します。

@raise Errno::EXXX file が存在しない場合、あるいはシステムコールに失敗した場合に発生します。

@raise IOError 指定された IO オブジェクト file が既に clo...
...se されていた場合に発生します。

@see FileTest.#size?, FileTest.#zero?

例:
FileTest
.size('/etc/passwd') # => 5925...

FileTest.#size?(file) -> Integer | nil (3120.0)

ファイルのサイズを返します。ファイルが存在しない時や ファイルのサイズが0の時には nil を返します。

...m file ファイル名を表す文字列か IO オブジェクトを指定します。

@raise IOError 指定された 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.#writable?(file) -> bool (3120.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
//}...

絞り込み条件を変える

FileTest.#empty?(file) -> bool (3115.0)

ファイルが存在して、そのサイズが 0 である時に真を返します。 そうでない場合、あるいはシステムコールに失敗した場合には false を返します。

...します。

@param file ファイル名を表す文字列か IO オブジェクトを指定します。

@raise IOError 指定された IO オブジェクト file が既に close されていた場合に発生します。

//emlist[例:][ruby]{
IO.write("zero.txt", "")
FileTest
.zero?("zero.txt")...
...# => true
IO.write("nonzero.txt", "1")
FileTest
.zero?("nonzero.txt") # => false
//}

@see FileTest.#size, FileTest.#size?...

FileTest.#zero?(file) -> bool (3115.0)

ファイルが存在して、そのサイズが 0 である時に真を返します。 そうでない場合、あるいはシステムコールに失敗した場合には false を返します。

...します。

@param file ファイル名を表す文字列か IO オブジェクトを指定します。

@raise IOError 指定された IO オブジェクト file が既に close されていた場合に発生します。

//emlist[例:][ruby]{
IO.write("zero.txt", "")
FileTest
.zero?("zero.txt")...
...# => true
IO.write("nonzero.txt", "1")
FileTest
.zero?("nonzero.txt") # => false
//}

@see FileTest.#size, FileTest.#size?...

FileTest.#pipe?(file) -> bool (3114.0)

指定したファイルがパイプである時に真を返します。そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。

...ます。

@param file ファイル名を表す文字列か IO オブジェクトを指定します。

@raise IOError 指定された IO オブジェクト file が既に close されていた場合に発生します。

例:
r, w = IO.pipe
FileTest
.pipe?(r) # => true
FileTest
.pipe?(w) # => t...

FileTest.#setuid?(file) -> bool (3114.0)

ファイルが setuid(2) されている時に真を返 します。そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。

...

@param file ファイル名を表す文字列か IO オブジェクトを指定します。

@raise IOError 指定された IO オブジェクト file が既に close されていた場合に発生します。

//emlist[例][ruby]{
require 'fileutils'
IO.write("testfile", "")
File
Utils.chmod("u...
...+s", "testfile")
FileTest
.setuid?("testfile") # => true
File
Utils.chmod("u-s", "testfile")
FileTest
.setuid?("testfile") # => false
//}...

FileTest.#socket?(file) -> bool (3114.0)

ファイルがソケットである時に真を返します。そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。

...@param file ファイル名を表す文字列か IO オブジェクトを指定します。

@raise IOError 指定された IO オブジェクト file が既に close されていた場合に発生します。

//emlist[例][ruby]{
require "socket"

IO.write("testfile", "test")
p FileTest.socket?(...
..."testfile") # => false
Socket.unix_server_socket('testsock') { p FileTest.socket?('testsock') } # => true
//}...

絞り込み条件を変える

<< < 1 2 3 4 > >>