るりまサーチ (Ruby 2.5.0)

最速Rubyリファレンスマニュアル検索!
30件ヒット [1-30件を表示] (0.050秒)
トップページ > クエリ:d[x] > クラス:File[x] > バージョン:2.5.0[x]

別のキーワード

  1. bigdecimal/util to_d
  2. float to_d
  3. rsa d
  4. rsa d=
  5. matrix d

ライブラリ

キーワード

検索結果

File.realdirpath(pathname, basedir = nil) -> String (18604.0)

与えられた pathname に対応する絶対パスを返します。

与えられた pathname に対応する絶対パスを返します。

pathname の最後のコンポーネントは存在していなくても例外は発生しません。

@param pathname ファイル名を指定します。

@param basedir ベースディレクトリを指定します。省略するとカレントディレクトリを使用します。

@raise Errno::ENOENT ファイルが存在しない場合に発生します。

File#chmod(mode) -> 0 (18304.0)

ファイルのモードを指定された mode に変更します。

...EXXX が発生し
ます。

@param mode chmod(2) と同様に整数で指定します。

@raise IOError 自身が close されている場合に発生します。

@raise Errno::EXXX 失敗した場合に発生します。

//emlist[例][ruby]{
f = File.new("out", "w");
f.chmod(0644) #=> 0
//}...

File.blockdev?(path) -> bool (18304.0)

FileTest.#blockdev? と同じです。

...
File
Test.#blockdev? と同じです。

@param path パスを表す文字列か IO オブジェクトを指定します。


@see FileTest.#blockdev?...

File.chardev?(path) -> bool (18304.0)

FileTest.#chardev? と同じです。

...
File
Test.#chardev? と同じです。

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

File.chmod(mode, *filename) -> Integer (18304.0)

ファイルのモードを mode に変更します。モードを変更したファイ ルの数を返します。

...ファイルのモードを mode に変更します。モードを変更したファイ
ルの数を返します。

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

@param mode chmod(2) と同様に整数で指定します。

@raise Errno::EXXX モードの変更に失敗...

絞り込み条件を変える

File.delete(*filename) -> Integer (18304.0)

ファイルを削除します。削除したファイルの数を返します。 削除に失敗した場合は例外 Errno::EXXX が発生します。

...m filename ファイル名を表す文字列を指定します。

@raise Errno::EXXX 失敗した場合に発生します。

//emlist[例][ruby]{
IO.write("test.txt", "test")
p File.exist?("test.txt") # => true
p File.delete("test.txt") # => 1
p File.exist?("test.txt") # => false
begin
File
....
...delete("test.txt")
rescue
p $! # => #<Errno::ENOENT: No such file or directory @ unlink_internal - test.txt>
end
//}...

File.directory?(path) -> bool (18304.0)

FileTest.#directory? と同じです。

...
File
Test.#directory? と同じです。

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

File.dirname(filename) -> String (18304.0)

filename の一番後ろのスラッシュより前を文 字列として返します。スラッシュを含まないファイル名に対しては "."(カレントディレクトリ)を返します。

...
file
name の一番後ろのスラッシュより前を文
字列として返します。スラッシュを含まないファイル名に対しては
"."(カレントディレクトリ)を返します。

//emlist[例][ruby]{
p File.dirname("dir/file.ext") # => "dir"
p File.dirname("file.ext")...
...# => "."
//}

File
.dirname の動作は dirname(3)
に従います。
//emlist[例][ruby]{
p File.dirname("foo/bar/") # => "foo"
p File.dirname("foo//bar") # => "foo"
//}


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

@see File.basename, File.extname...

File.expand_path(path, default_dir = &#39;.&#39;) -> String (18304.0)

path を絶対パスに展開した文字列を返します。 path が相対パスであれば default_dir を基準にします。

...> "/home/matz/work/foo"
p ENV["HOME"] #=> "/home/matz"
p File.expand_path("..") #=> "/home/matz/work"
p File.expand_path("..", "/tmp") #=> "/"
p File.expand_path("~") #=> "/home/matz"
p File.expand_path("~foo") #=> "/home/foo"
//}

@param path パスを表...

File.grpowned?(path) -> bool (18304.0)

FileTest.#grpowned? と同じです。

...
File
Test.#grpowned? と同じです。

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

絞り込み条件を変える

File.identical?(filename1, filename2) -> bool (18304.0)

FileTest.#identical? と同じです。

...
File
Test.#identical? と同じです。

@param filename1 パスを表す文字列か IO オブジェクトを指定します。

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

File.lchmod(mode, *filename) -> Integer (18304.0)

File.chmod と同様ですが、シンボリックリンクに関してリンクそのものの モードを変更します。

...
File
.chmod と同様ですが、シンボリックリンクに関してリンクそのものの
モードを変更します。

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

@param mode chmod(2) と同様に整数で指定します。

@raise NotImplementedError lchmod(2)...
...生します。

//emlist[例][ruby]{
IO.write("testfile", "test")
File
.symlink("testfile", "testlink")
File
.lstat("testlink").ftype # => "link"
File
.lchmod(0744, "testlink")
File
.stat("testlink").mode.to_s(8) # => "100644"
File
.lstat("testlink").mode.to_s(8) # => "120744"
//}...

File.owned?(path) -> bool (18304.0)

FileTest.#owned? と同じです。

...
File
Test.#owned? と同じです。

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

File.readable?(path) -> bool (18304.0)

FileTest.#readable? と同じです。

...
File
Test.#readable? と同じです。

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

File.readable_real?(path) -> bool (18304.0)

FileTest.#readable_real? と同じです。

...
File
Test.#readable_real? と同じです。

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

絞り込み条件を変える

File.readlink(path) -> String (18304.0)

シンボリックリンクのリンク先のパスを文字列で返します。

...XX 指定された path がシンボリックリンクでない場合や、リンクの読み取りに失敗した場合に発生します。

//emlist[例:][ruby]{
IO.write("testfile", "test")
File
.symlink("testfile", "testlink") # => 0
File
.readlink("testlink") # => "testfile"
//}...

File.setgid?(path) -> bool (18304.0)

FileTest.#setgid? と同じです。

...
File
Test.#setgid? と同じです。

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

File.setuid?(path) -> bool (18304.0)

FileTest.#setuid? と同じです。

...
File
Test.#setuid? と同じです。

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

File.world_readable?(path) -> Integer | nil (18304.0)

path が全てのユーザから読めるならばそのファイルのパーミッションを表す 整数を返します。そうでない場合は nil を返します。

...場合は nil を返します。

整数の意味はプラットフォームに依存します。

@param path パスを表す文字列か IO オブジェクトを指定します。

//emlist[例][ruby]{
m = File.world_readable?("/etc/passwd")
"%o" % m # => "644"
//}...

File.world_writable?(path) -> bool (18304.0)

path が全てのユーザから書き込めるならば、そのファイルのパーミッションを表す 整数を返します。そうでない場合は nil を返します。

...でない場合は nil を返します。

整数の意味はプラットフォームに依存します。

@param path パスを表す文字列か IO オブジェクトを指定します。

//emlist[例][ruby]{
m = File.world_writable?("/tmp")
"%o" % m #=> "777"
//}...

絞り込み条件を変える

File.unlink(*filename) -> Integer (9004.0)

ファイルを削除します。削除したファイルの数を返します。 削除に失敗した場合は例外 Errno::EXXX が発生します。

...m filename ファイル名を表す文字列を指定します。

@raise Errno::EXXX 失敗した場合に発生します。

//emlist[例][ruby]{
IO.write("test.txt", "test")
p File.exist?("test.txt") # => true
p File.delete("test.txt") # => 1
p File.exist?("test.txt") # => false
begin
File
....
...delete("test.txt")
rescue
p $! # => #<Errno::ENOENT: No such file or directory @ unlink_internal - test.txt>
end
//}...

File.absolute_path(file_name, dir_string=nil) -> String (304.0)

file_name を絶対パスに変換した文字列を返します。

...
file
_name を絶対パスに変換した文字列を返します。

相対パスの場合はカレントディレクトリを基準とします。
dir_string を渡した場合はそのディレクトリを基準とします。

File
.expand_path と異なり、 file_name 先頭が "~" である場...
...ME"] #=> "/home/matz"
p File.absolute_path("..") #=> "/home/matz/work"
p File.absolute_path("..", "/tmp") #=> "/"
p File.absolute_path("~") #=> "/home/matz/work/bar/~"
p File.absolute_path("~foo") #=> "/home/matz/work/bar/~foo"
//}

@see File.expand_path...

File.link(old, new) -> 0 (304.0)

old を指す new という名前のハードリンクを 生成します。old はすでに存在している必要があります。 ハードリンクに成功した場合は 0 を返します。

...を指定します。

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

@raise Errno::EXXX 失敗した場合に発生します。

//emlist[例][ruby]{
IO.write("testfile", "test")
File
.link("testfile", "testlink") # => 0
IO.read("testlink") # => "test"
//}...

File.mkfifo(file_name, mode = 0666) -> 0 (304.0)

引数 file_name で指定した名前の FIFO スペシャルファイルを作成します。

...引数 file_name で指定した名前の FIFO スペシャルファイルを作成します。

@param file_name ファイル名を指定します。

@param mode FIFO の許可モードを数値で指定します。指定したモードは通常の
ファイル作成と同様にプロ...
...セスの umask によって変更されます。
作成されたファイルの許可モードは (mode & ~umask) になります。

//emlist[例][ruby]{
File
.mkfifo("testfile", 0666)
File
.ftype("testfile") # => "fifo"
//}...

File.new(path, mode = "r", perm = 0666) -> File (304.0)

path で指定されるファイルをオープンし、File オブジェクトを生成して 返します。

...File オブジェクトを生成して
返します。

path が整数の場合はファイルディスクリプタとして扱い、それに対応する
File
オブジェクトを生成して返します。IO.open と同じです。
ブロックを指定して呼び出した場合は、File...
...mlist[例: File.new による読み込みモードでのファイルオープン][ruby]{
f = File.new("testfile", "r")
f.class # => File
f.close
//}

//emlist[例: File.open による読み込みモードでのファイルオープン][ruby]{
f = File.open("testfile", "r")
f.class # => File
f.close...
...//}

//emlist[例: File.open による書き込みモードでのファイルオープン][ruby]{
File
.open("testfile", "w", 0755) { |f| f.print "test" }
File
.read("testfile") # => "test"
//}...

絞り込み条件を変える

File.open(path, mode = "r", perm = 0666) -> File (304.0)

path で指定されるファイルをオープンし、File オブジェクトを生成して 返します。

...File オブジェクトを生成して
返します。

path が整数の場合はファイルディスクリプタとして扱い、それに対応する
File
オブジェクトを生成して返します。IO.open と同じです。
ブロックを指定して呼び出した場合は、File...
...mlist[例: File.new による読み込みモードでのファイルオープン][ruby]{
f = File.new("testfile", "r")
f.class # => File
f.close
//}

//emlist[例: File.open による読み込みモードでのファイルオープン][ruby]{
f = File.open("testfile", "r")
f.class # => File
f.close...
...//}

//emlist[例: File.open による書き込みモードでのファイルオープン][ruby]{
File
.open("testfile", "w", 0755) { |f| f.print "test" }
File
.read("testfile") # => "test"
//}...

File.open(path, mode = "r", perm = 0666) {|file| ... } -> object (304.0)

path で指定されるファイルをオープンし、File オブジェクトを生成して 返します。

...File オブジェクトを生成して
返します。

path が整数の場合はファイルディスクリプタとして扱い、それに対応する
File
オブジェクトを生成して返します。IO.open と同じです。
ブロックを指定して呼び出した場合は、File...
...mlist[例: File.new による読み込みモードでのファイルオープン][ruby]{
f = File.new("testfile", "r")
f.class # => File
f.close
//}

//emlist[例: File.open による読み込みモードでのファイルオープン][ruby]{
f = File.open("testfile", "r")
f.class # => File
f.close...
...//}

//emlist[例: File.open による書き込みモードでのファイルオープン][ruby]{
File
.open("testfile", "w", 0755) { |f| f.print "test" }
File
.read("testfile") # => "test"
//}...

File.realpath(pathname, basedir = nil) -> String (304.0)

与えられた pathname に対応する絶対パスを返します。

...合に発生します。

//emlist[例][ruby]{
ENV["HOME"] # => "/home/matz"
File
.symlink("testfile", "testlink")
File
.realpath("testfile") # => "/home/matz/testfile"
File
.realpath("testlink") # => "/home/matz/testfile"
File
.realpath("..", "/tmp") # => "/"
//}...

File.symlink(old, new) -> 0 (304.0)

old への new という名前のシンボリックリンクを生成します。

...発生します。

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

@param new シンボリックリンクを表す文字列を指定します。

@raise Errno::EXXX 失敗した場合に発生します。

//emlist[例][ruby]{
File
.symlink("testfile", "testlink") # => 0
//}...

File.join(*item) -> String (124.0)

File::SEPARATORを間に入れて文字列を連結します。platform/DOSISH-supportで環境依存になる予定です。

...
File
::SEPARATORを間に入れて文字列を連結します。platform/DOSISH-supportで環境依存になる予定です。

@param item 連結したいディレクトリ名やファイル名を文字列(もしくは文字列を要素に持つ配列)で与えます。
文字列A...
...とBを連結する際に、Aの末尾の文字とBの先頭の文字がFile::SEPARATORであった場合には、
まずこれらを削除した上で改めてFile::SEPARATORを間に入れて連結します。
引数の中に配列がある場合は配列要素を再帰的...
...t[例][ruby]{
File
.join("a","b") # => "a/b"
File
.join("a/","b") # => "a/b"
File
.join("a/","/b") # => "a/b"
File
.join("a","/b") # => "a/b"
File
.join("a", ["b", ["c", ["d"]]]) # => "a/b/c/d"
File
.join("", "a"...

絞り込み条件を変える