るりまサーチ

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

別のキーワード

  1. _builtin path
  2. pathname to_path
  3. _builtin absolute_path
  4. _builtin to_path
  5. pstore path

ライブラリ

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

File.path(filename) -> String (27307.0)

指定されたファイル名を文字列で返します。filename が文字列でない場合は、to_path メソッドを呼びます。

...filename が文字列でない場合は、to_path メソッドを呼びます。

@param filename ファイル名を表す文字列か to_path メソッドが定義されたオブジェクトを指定します。

//emlist[例][ruby]{
require
'pathname'

class MyPath
def initialize(path)
@path...
...= path
end
def to_path
File
.absolute_path(@path)
end
end

File
.path("/dev/null") # => "/dev/null"
File
.path(Pathname("/tmp")) # => "/tmp"
File
.path(MyPath.new(".")) # => "/Users/user/projects/txt"
//}...

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

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

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

Tempfile#path -> String | nil (21119.0)

テンポラリファイルのパス名を返します。

...テンポラリファイルのパス名を返します。

Tempfile#close! を実行後だった場合にはnilを返します。

require
"tempfile"
tf = Tempfile.new("hoo")
p tf.path # => "/tmp/hoo.10596.0"
tf.close!
p tf.path # => nil...

Digest::Base#file(path) -> self (18260.0)

ファイル名 file で指定したファイルの内容を読み込んでダイジェストを更新し、 オブジェクト自身を返します。

...ル名 file で指定したファイルの内容を読み込んでダイジェストを更新し、
オブジェクト自身を返します。

@param path 読み込み対象のファイル名です。
@return ダイジェストオブジェクトを返します。

例(MD5の場合)

require
'dige...
...st/md5'
digest = Digest::MD5.new
digest.file("/path/to/file") # => Digest::MD5のインスタンス
digest.hexdigest # => "/path/to/file"のMD5値...

Digest::Base.file(path) -> object (18236.0)

新しいダイジェストオブジェクトを生成し、 ファイル名 file で指定したファイルの内容を読み込み、 そのダイジェストオブジェクトを返します。

...ル名 file で指定したファイルの内容を読み込み、
そのダイジェストオブジェクトを返します。

@param path 読み込み対象のファイル名です。
@return ダイジェストオブジェクトを返します。

使用例(SHA256の場合)

require
'dige...
...st'
digest = Digest::SHA256.file("X11R6.8.2-src.tar.bz2")
digest.hexdigest
# => "f02e3c85572dc9ad7cb77c2a638e3be24cc1b5bea9fdbb0b0299c9668475c534"...

絞り込み条件を変える

LoadError#path -> String | nil (18141.0)

Kernel.#require や Kernel.#load に失敗したパスを返します。

...Kernel.#require や Kernel.#load に失敗したパスを返します。

begin
require
'this/file/does/not/exist'
rescue LoadError => e
e.path # => 'this/file/does/not/exist'
end

パスが定まらない場合は nil を返します。...

Pathname#expand_path(default_dir = &#39;.&#39;) -> Pathname (9299.0)

Pathname.new(File.expand_path(self.to_s, *args)) と同じです。

...Pathname.new(File.expand_path(self.to_s, *args)) と同じです。

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

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

path
= Pathname("testfile")
Path
name.pwd # => #<Pathname:/path/to>
path
.expand_...
...path # => #<Pathname:/path/to/testfile>
path
.expand_path("../") # => #<Pathname:/path/testfile>
//}

@see File.expand_path...

Pathname#cleanpath(consider_symlink = false) -> Pathname (9260.0)

余計な "."、".." や "/" を取り除いた新しい Pathname オブジェクトを返します。

...余計な "."、".." や "/" を取り除いた新しい Pathname オブジェクトを返します。

cleanpath は、実際にファイルシステムを参照することなく、文字列操作
だけで処理を行います。

@param consider_symlink 真ならパス要素にシンボリック...
..... を残します。

//emlist[例][ruby]{
require
"pathname"
path
= Pathname.new("//.././../")
path
# => #<Pathname://.././../>
path
.cleanpath # => #<Pathname:/>


require
'pathname'
Dir.rmdir("/tmp/foo") rescue nil
File
.unlink("/tmp/bar/foo") rescue nil
Dir.rmdir("/t...
...mp/bar") rescue nil
Dir.mkdir("/tmp/foo")
Dir.mkdir("/tmp/bar")
File
.symlink("../foo", "/tmp/bar/foo")
path
= Pathname.new("bar/././//foo/../bar")
Dir.chdir("/tmp")

path
.cleanpath # => #<Pathname:bar/bar>
path
.cleanpath(true) # => #<Pathname:bar/foo/../bar>
//}...

Pathname#realpath -> Pathname (9236.0)

余計な "."、".." や "/" を取り除いた新しい Pathname オブジェクトを返します。

...余計な "."、".." や "/" を取り除いた新しい Pathname オブジェクトを返します。

また、ファイルシステムをアクセスし、実際に存在するパスを返します。
シンボリックリンクも解決されます。

self が指すパスが存在しない場...
...{
require
'pathname'

Dir.rmdir("/tmp/foo") rescue nil
File
.unlink("/tmp/bar/foo") rescue nil
Dir.rmdir("/tmp/bar") rescue nil

Dir.mkdir("/tmp/foo")
Dir.mkdir("/tmp/bar")
File
.symlink("../foo", "/tmp/bar/foo")
path
= Pathname.new("bar/././//foo/../bar")

Dir.chdir("/tmp")

p path.realpath...
...# => ruby 1.8.0 (2003-10-10) [i586-linux]
# #<Pathname:/tmp/bar>
//}

@see Pathname#realdirpath, File.realpath...

Pathname#realpath(basedir = nil) -> Pathname (9236.0)

余計な "."、".." や "/" を取り除いた新しい Pathname オブジェクトを返します。

...余計な "."、".." や "/" を取り除いた新しい Pathname オブジェクトを返します。

また、ファイルシステムをアクセスし、実際に存在するパスを返します。
シンボリックリンクも解決されます。

self が指すパスが存在しない場...
...{
require
'pathname'

Dir.rmdir("/tmp/foo") rescue nil
File
.unlink("/tmp/bar/foo") rescue nil
Dir.rmdir("/tmp/bar") rescue nil

Dir.mkdir("/tmp/foo")
Dir.mkdir("/tmp/bar")
File
.symlink("../foo", "/tmp/bar/foo")
path
= Pathname.new("bar/././//foo/../bar")

Dir.chdir("/tmp")

p path.realpath...
...# => ruby 1.8.0 (2003-10-10) [i586-linux]
# #<Pathname:/tmp/bar>
//}

@see Pathname#realdirpath, File.realpath...

絞り込み条件を変える

<< 1 2 3 ... > >>