325件ヒット
[1-100件を表示]
(0.061秒)
クラス
-
ARGF
. class (22) - Dir (22)
-
Encoding
:: Converter (11) - Exception (11)
- File (22)
-
File
:: Stat (22) - IO (59)
- LoadError (11)
- Proc (11)
-
RubyVM
:: InstructionSequence (44) - SyntaxError (2)
- Thread (22)
-
Thread
:: Backtrace :: Location (44) - TracePoint (22)
キーワード
- <=> (11)
-
absolute
_ path (22) -
backtrace
_ locations (22) - convpath (11)
- fdatasync (11)
- filename (11)
- flush (11)
- inspect (33)
- reopen (33)
-
set
_ backtrace (11) - size? (11)
-
source
_ location (11) -
to
_ a (11) -
to
_ path (24) -
to
_ s (11)
検索結果
先頭5件
-
IO
# path -> String | nil (18129.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"
//}... -
File
# path -> String (18123.0) -
オープン時に使用したパスを文字列で返します。
...作成されていたりする場合です。
//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 } #=> "/tmp"
//}......発生します。
//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?)
//}... -
RubyVM
:: InstructionSequence # path -> String (18122.0) -
self が表す命令シーケンスの相対パスを返します。
...ompiled>@<compiled>>
iseq.path
# => "<compiled>"
例2: RubyVM::InstructionSequence.compile_file を使用した場合
# /tmp/method.rb
def hello
puts "hello, world"
end
# irb
> iseq = RubyVM::InstructionSequence.compile_file('method.rb')
> iseq.path # => "method.rb"
@see Ruby......VM::InstructionSequence#absolute_path... -
Dir
# path -> String (18117.0) -
オープンしているディレクトリのパス名を文字列で返します。
...オープンしているディレクトリのパス名を文字列で返します。
//emlist[例][ruby]{
Dir.open("..") do |d|
d.path # => ".."
d.to_path # => ".."
end
//}... -
Thread
:: Backtrace :: Location # path -> String (18116.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 (18116.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
//}... -
LoadError
# path -> String | nil (18110.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 を返します。... -
SyntaxError
# path -> String (18104.0) -
文法エラーがあったファイルのパスを返します。
文法エラーがあったファイルのパスを返します。 -
ARGF
. class # path -> String (15104.0) -
現在開いている処理対象のファイル名を返します。
現在開いている処理対象のファイル名を返します。
標準入力に対しては - を返します。
組み込み変数 $FILENAME と同じです。
$ echo "foo" > foo
$ echo "bar" > bar
$ echo "glark" > glark
$ ruby argf.rb foo bar glark
ARGF.filename # => "foo"
ARGF.read(5) # => "foo\nb"
ARGF.filename # => "bar"
ARGF.skip
ARGF.filename # => "glark" -
Thread
:: Backtrace :: Location # absolute _ path -> String (6134.0) -
self が表すフレームの絶対パスを返します。
...][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end
Foo.new(0..2).locations.map do |call|
puts call.absolute_path
end
# => /path/to/foo.rb
# /path/to/foo.rb
# /path/to/foo.rb
//}
@see Thread::Backtrace::Location#path... -
IO
# to _ path -> String | nil (6129.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"
//}... -
File
# to _ path -> String (6123.0) -
オープン時に使用したパスを文字列で返します。
...作成されていたりする場合です。
//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 } #=> "/tmp"
//}......発生します。
//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?)
//}...