るりまサーチ

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

別のキーワード

  1. io popen
  2. io pipe
  3. io each
  4. io readlines
  5. io each_line

ライブラリ

キーワード

検索結果

<< 1 2 > >>

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

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

...列か 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 (37.0)

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

...列か 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.#grpowned?(file) -> bool (25.0)

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

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

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

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

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

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

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

@raise IOError 指定された 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.#setuid?(file) -> bool (25.0)

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

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

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

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

絞り込み条件を変える

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

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

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

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

//emlist[例][ruby]{
IO
.write("testfile", "test")
FileTest
.size?("testfile") # => 4
File.delete("testfile")
FileTest
.size?("te...
...stfile") # => nil
//}

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

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

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

...イル名を表す文字列か 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
//}...

FileTest.#setgid?(file) -> bool (19.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") # => fal...

FileTest.#sticky?(file) -> bool (19.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") # => fal...

FileTest.#executable_real?(file) -> bool (13.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 > >>