るりまサーチ

最速Rubyリファレンスマニュアル検索!
727件ヒット [1-100件を表示] (0.058秒)
トップページ > クエリ:new[x] > クエリ:path[x] > 種類:インスタンスメソッド[x]

別のキーワード

  1. openssl new
  2. _builtin new
  3. rexml/document new
  4. resolv new
  5. socket new

ライブラリ

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

IO#path -> String | nil (18139.0)

IO に関連付けられたパスを返します。IO がパスに関連付けられていない場合は nil を返します。

...が返すパスがファイルシステム上に存在することは保証されていません。

//emlist[例][ruby]{
p STDIN.path # => "<STDIN>"
p IO.new(IO.sysopen("/")).path # => "/"
p IO.new(IO.sysopen("/"), path: "foo").path # => "foo"
//}...

Net::HTTPGenericRequest#path -> String (18130.0)

リクエストする path を文字列で返します。

...リクエストする path を文字列で返します。

//emlist[例][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.path # => "/index.html"
//}...

Tempfile#path -> String | nil (18120.0)

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

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

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

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

TracePoint#path -> String (18120.0)

イベントが発生したファイルのパスを返します。

...トが発生したファイルのパスを返します。

@raise RuntimeError イベントフックの外側で実行した場合に発生します。

//emlist[例][ruby]{
def foo(ret)
ret
end
trace = TracePoint.new(:call) do |tp|
p tp.path # => "/path/to/test.rb"
end
trace.enable
foo 1
//}...

WIN32OLE_TYPELIB#path -> String (18114.0)

TypeLibのパス名を取得します。

...raise WIN32OLERuntimeError TypeLibの属性が読み取れない場合に通知します。

tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 14.0 Object Library')
puts tlib.path # => 'C:\...\EXCEL.EXE'

TypeLibは拡張子TLB(まれにOLB)という独立したファイルの場合と、サー...

絞り込み条件を変える

Pathname#expand_path(default_dir = &#39;.&#39;) -> Pathname (9288.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 (9249.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") res...
...cue 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")

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

Pathname#relative_path_from(base_directory) -> Pathname (9232.0)

base_directory から self への相対パスを求め、その内容の新しい Pathname オブジェクトを生成して返します。

...base_directory から self への相対パスを求め、その内容の新しい Pathname
オブジェクトを生成して返します。

パス名の解決は文字列操作によって行われ、ファイルシステムをアクセス
しません。

self が相対パスなら base_directory...
...を表す Pathname オブジェクトを指定します。

@raise ArgumentError Windows上でドライブが違うなど、base_directory から self への相対パスが求められないときに例外が発生します。

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

path
= Pathname.new("/tmp/foo")...
...base = Pathname.new("/tmp")

path
.relative_path_from(base) # => #<Pathname:foo>
//}...

Pathname#realpath -> Pathname (9219.0)

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

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

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

self が指すパスが存在しない場...
...uire '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 (9219.0)

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

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

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

self が指すパスが存在しない場...
...uire '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 ... > >>