るりまサーチ

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

別のキーワード

  1. fiddle ruby_free
  2. rbconfig ruby
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

RubyVM::InstructionSequence#path -> String (21126.0)

self が表す命令シーケンスの相対パスを返します。

...= RubyVM::InstructionSequence.compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
iseq.path
# => "<compiled>"

例2: RubyVM::InstructionSequence.compile_file を使用した場合

# /tmp/method.rb
def hello
puts "hello, world"
end

# irb
> iseq = Ruby...
...VM::InstructionSequence.compile_file('method.rb')
> iseq.path # => "method.rb"

@
see RubyVM::InstructionSequence#absolute_path...

File#path -> String (18133.0)

オープン時に使用したパスを文字列で返します。

...る場合です。

@
raise IOError TMPFILE File::Constants::TMPFILEオプション付きで作成されている場合に発生します。

//emlist[例][ruby]{
File.open("testfile") {|f| f.path } #=> "testfile"
File.open("/tmp/../tmp/xxx", "w") {|f| f.path } #=> "...
.../tmp/../tmp/xxx"
File.open("/tmp", File::RDWR | File::TMPFILE){|f| f.path } # IOError: File is unnamed (TMPFILE?)
//}...

Thread::Backtrace::Location#path -> String (18126.0)

self が表すフレームのファイル名を返します。

...self が表すフレームのファイル名を返します。

例: Thread::Backtrace::Location の例1を用いた例

//emlist[][ruby]{
loc = c(0..1).first
loc.path # => "caller_locations.rb"
//}

@
see Thread::Backtrace::Location#absolute_path...

TracePoint#path -> String (18126.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 (18126.0)

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

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

@
return TypeLibのパス名を文字列で返します。この値はレジストリの登録値を
そのまま利用するため、Rubyのパス名形式(ディレクトリ区切りは
「/」)ではなく、Windowsのパス名形式(...
...ディレクトリ区切りは「\」)
です。
@
raise WIN32OLERuntimeError TypeLibの属性が読み取れない場合に通知します。

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

TypeLibは拡張子TLB(まれに...

絞り込み条件を変える

Pathname#expand_path(default_dir = &#39;.&#39;) -> Pathname (9290.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/f...
...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")

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

Pathname#realdirpath(basedir = nil) -> Pathname (9249.0)

Pathname#realpath とほぼ同じで、最後のコンポーネントは実際に 存在しなくてもエラーになりません。

...
Path
name#realpath とほぼ同じで、最後のコンポーネントは実際に
存在しなくてもエラーになりません。

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

//emlist[例][ruby]{
require "pathna...
...me"

path
= Pathname("/not_exist")
path
.realdirpath # => #<Pathname:/not_exist>
path
.realpath # => Errno::ENOENT

# 最後ではないコンポーネント(/not_exist_1)も存在しないのでエラーになる。
path
= Pathname("/not_exist_1/not_exist_2")
path
.realdirpath # => Errno::ENOENT...
...//}

@
see Pathname#realpath...

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

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

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

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

self が相対パスなら base_directory...
...

@
param 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>
//}...
<< 1 2 3 ... > >>