るりまサーチ

最速Rubyリファレンスマニュアル検索!
239件ヒット [1-100件を表示] (0.042秒)

別のキーワード

  1. _builtin file?
  2. _builtin file
  3. file size
  4. file chown
  5. file mtime

クラス

モジュール

キーワード

検索結果

<< 1 2 3 > >>

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

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

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

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

File
.expand_path と異なり、 file_name 先頭が "~" である場...
...#=> "/home/matz/work/bar"
p ENV["HOME"] #=> "/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.dirname(filename, level=1) -> String (21184.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"
//}

level が指定されたときは、最後のlevel個を取り除いた文字列を返します。

//emlist[leve...
...lを指定する例][ruby]{
File
.dirname("/home/gumby/work/ruby.rb", 2) # => "/home/gumby"
File
.dirname("/home/gumby/work/ruby.rb", 4) # => "/"
//}

@param filename ファイル名を表す文字列を指定します。
@param level 末尾からいくつ取り除くかを指定します。

@raise A...

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

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

...変数 HOME が使われます)に、
~USER はそのユーザのホームディレクトリに展開されます。

//emlist[例][ruby]{
p Dir.getwd #=> "/home/matz/work/foo"
p ENV["HOME"] #=> "/home/matz"
p File.expand_path("..") #=> "/home/matz/wor...
...k"
p File.expand_path("..", "/tmp") #=> "/"
p File.expand_path("~") #=> "/home/matz"
p File.expand_path("~foo") #=> "/home/foo"
//}

@param path パスを表す文字列を指定します。

@param default_dir path が相対パスであれば default_dir を基準に展開されま...

File.realpath(pathname, basedir = nil) -> String (21048.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") # => "/"
//}...

Dir.home -> String | nil (18150.0)

現在のユーザまたは指定されたユーザのホームディレクトリを返します。

...れたユーザのホームディレクトリを返します。

Dir.home や Dir.home("root") は
File
.expand_path("~") や File.expand_path("~root") と
ほぼ同じです。

//emlist[例][ruby]{
Dir.home # => "/home/vagrant"
Dir.home("root") # => "/root"
//}

@see File.expand_path...
...されたユーザのホームディレクトリを返します。

Dir.home や Dir.home("root") は
File
.expand_path("~") や File.expand_path("~root") と
ほぼ同じです。

//emlist[例][ruby]{
Dir.home # => "/home/vagrant"
Dir.home("root") # => "/root"
//}

@see File.expand_path...

絞り込み条件を変える

Dir.home(user) -> String | nil (18150.0)

現在のユーザまたは指定されたユーザのホームディレクトリを返します。

...れたユーザのホームディレクトリを返します。

Dir.home や Dir.home("root") は
File
.expand_path("~") や File.expand_path("~root") と
ほぼ同じです。

//emlist[例][ruby]{
Dir.home # => "/home/vagrant"
Dir.home("root") # => "/root"
//}

@see File.expand_path...
...されたユーザのホームディレクトリを返します。

Dir.home や Dir.home("root") は
File
.expand_path("~") や File.expand_path("~root") と
ほぼ同じです。

//emlist[例][ruby]{
Dir.home # => "/home/vagrant"
Dir.home("root") # => "/root"
//}

@see File.expand_path...

Gem::RequirePathsBuilder#write_require_paths_file_if_needed(spec = @spec, gem_home = @gem_home) (6303.0)

必要であれば、'.require_paths' というファイルを Gem ごとに作成します。

必要であれば、'.require_paths' というファイルを Gem ごとに作成します。

WEBrick::Config::FileHandler -> Hash (6112.0)

WEBrick::HTTPServlet::FileHandler の設定のデフォルト値を保持したハッシュです。

...WEBrick::HTTPServlet::FileHandler の設定のデフォルト値を保持したハッシュです。

require 'webrick'
WEBrick::Config::FileHandler = {
:NondisclosureName => [".ht*", "*~"],
:FancyIndexing => false,
:HandlerTable => {},
:HandlerCallback =>...
...nil,
:DirectoryCallback => nil,
:FileCallback => nil,
:UserDir => nil, # e.g. "public_html"
:AcceptableLanguages => [] # ["en", "ja", ... ]
}

: :AcceptableLanguages

コンテンツの言語を選択するオプション。設定値は文字列の配列...
...クトリ名。値は文字列。

ユーザfooのホームディレクトリが/home/fooで、:UserDirにpublic_htmlを設定した場合、
クライアントから/~foo/index.htmlがリクエストされると/home/foo/public_html/index.htmlの内容を表示される。

この設定を有効に...

FileUtils.#cp_lr(src, dest, noop: nil, verbose: nil, dereference_root: true, remove_destination: false) (3006.0)

src へのハードリンク dest を作成します。 src がディレクトリの場合、再帰的にリンクします。 dest がディレクトリの場合、src へのハードリンク dest/src を作成します。

...ルかディレクトリです。

@param options :noop, :verbose, :dereference_root, :remove_destination が指定できます。
c:FileUtils#options

@raise ArgumentError dest が src に含まれる場合に発生します。
@raise Errno::EEXIST src が一つで dest がすでに...
...quire 'fileutils'
File
Utils.rm_r site_ruby + '/mylib', force: true
File
Utils.cp_lr 'lib/', site_ruby + '/mylib'
//}

//emlist[様々なファイルを対象ディレクトリにリンクする例][ruby]{
require 'fileutils'
File
Utils.cp_lr %w(mail.rb field.rb debug/), site_ruby + '/tmail'
File
Utils....
...cp_lr Dir.glob('*.rb'), '/home/aamine/lib/ruby', noop: true, verbose: true
//}

//emlist[内容をリンクする例][ruby]{
require 'fileutils'
# ディレクトリそのものではなく、ディレクトリの内容をリンクしたい場合は、
# 以下のようになります。(たとえ...

FileUtils.#cp_r(src, dest, options = {}) -> () (3006.0)

src を dest にコピーします。src がディレクトリであったら再帰的に コピーします。その際 dest がディレクトリなら dest/src にコピーします。

...ます。
c:FileUtils#options

//emlist[][ruby]{
# installing ruby library "mylib" under the site_ruby
require 'fileutils'
File
Utils.rm_r(site_ruby + '/mylib', force: true)
File
Utils.cp_r('lib/', site_ruby + '/mylib')
# other sample
require 'fileutils'
File
Utils.cp_r(%w(mail.rb field....
...rb debug/), site_ruby + '/tmail')
File
Utils.cp_r(Dir.glob('*.rb'), '/home/taro/lib/ruby',
noop: true, verbose: true)
//}...

絞り込み条件を変える

<< 1 2 3 > >>