るりまサーチ

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

別のキーワード

  1. _builtin -
  2. open-uri open
  3. irb/input-method new
  4. irb/input-method gets
  5. matrix -

ライブラリ

キーワード

検索結果

<< 1 2 3 > >>

FileTest.#owned?(file) -> bool (113.0)

ファイルのユーザがカレントプロセスの実効ユーザと等しい時に真を返します。そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。

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

//emlist[例][ruby]{
IO.write("testfile", "")
File.chown(Process.uid, -1, "testfile")
FileTest
.owned?("testfile") # => true
File.chown(501, -1, "testfile")
FileTest
.owned?("testfile") # => false
//}...

FileTest.#setgid?(file) -> bool (107.0)

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

...名を表す文字列か IO オブジェクトを指定します。

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

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

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

...ト file が既に close されていた場合に発生します。

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

FileTest.#sticky?(file) -> bool (107.0)

ファイルの sticky ビット(chmod(2) 参照)が 立っている時に真を返します。そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。

...名を表す文字列か IO オブジェクトを指定します。

//emlist[例][ruby]{
require 'fileutils'
IO.write("testfile", "")
FileUtils.chmod("o+t", "testfile")
FileTest
.sticky?("testfile") # => true
FileUtils.chmod("o-t", "testfile")
FileTest
.sticky?("testfile") # => false
//}...

FileTest.#blockdev?(file) -> bool (101.0)

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

...す文字列か IO オブジェクトを指定します。

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

例:
Dir.glob("/dev/*") { |file|
puts file if FileTest.blockdev?(file)
}
# /dev/disk0
# /dev/disk0s3
# ......

絞り込み条件を変える

FileTest.#chardev?(file) -> bool (101.0)

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

...表す文字列か IO オブジェクトを指定します。

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

例:
Dir.glob("/dev/*") { |file|
puts file if FileTest.chardev?(file)
}
# /dev/console
# /dev/tty
# ......

FileTest.#directory?(file) -> bool (101.0)

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

...ブジェクト file が既に close されていた場合に発生します。

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

f = File.open('/etc')
FileTest
.directory?(f) # => true
f.close
FileTest
.directory?(f) # => IOError: closed stream...

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

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

...された 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.#executable?(file) -> bool (101.0)

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

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

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

例:
FileTest
.executable?('/bin') # => true
FileTest
.executable?('/bin/bash') # => true...

FileTest.#executable_real?(file) -> bool (101.0)

ファイルがカレントプロセスの実ユーザか実グループで実行できる時に真を返します。そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。

...ます。

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

//emlist[例][ruby]{
IO.write("empty.txt", "")
File.chmod(0744, "empty.txt")
FileTest
.executable_real?("empty.txt") # => true
File.chmod(0644, "empty.txt")
FileTest
.executable_real?("empty.txt") # => false
//}...

絞り込み条件を変える

<< 1 2 3 > >>