るりまサーチ

最速Rubyリファレンスマニュアル検索!
1503件ヒット [1-100件を表示] (0.046秒)
トップページ > クエリ:ruby[x] > クエリ:file[x] > クエリ:path[x]

別のキーワード

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

ライブラリ

モジュール

検索結果

<< 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"
//}...

File#path -> String (27168.0)

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

...
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::R...
...DWR | File::TMPFILE){|f| f.path } #=> "/tmp"
//}...
...Error 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?)
//}...

rubygems/commands/generate_index_command (26042.0)

ある Gem サーバに対するインデックスを作成するためのライブラリです。

...g-file FILE 指定された設定ファイルを使用します
--backtrace バックトレースを表示します
--debug Ruby 自体のデバッグオプションを有効にします
Summary:
Generates the index files...
...statically. The command expects a 'gems' directory under the path given to
the --directory option. When done, it will generate a set of files like
this:

gems/ # .gem files you want to
index
quick/index
quick/ind...
...gacy YAML quick index
file

quick/Marshal.<version>/<gemname>.gemspec.rz # Marshal quick index file
Marshal.<version>
Marshal.<version>.Z # Marshal full index
yaml
yaml.Z # legacy YAML full index

The .Z and .rz extension files are compressed with...

rubygems/commands/mirror_command (26024.0)

リモートリポジトリをローカルリポジトリにミラーするためのライブラリです。

...静かに実行します
--config-file FILE 指定された設定ファイルを使用します
--backtrace バックトレースを表示します
--debug Ruby 自体のデバッグオプションを有効にし...
...す。設定ファイルは YAML で以下のように書きます。

---
- from: http://gems.example.com # source repository URI
to: /path/to/mirror # destination directory

複数の取得元と配置先を指定することができます。...

RubyVM::InstructionSequence#path -> String (21131.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...

絞り込み条件を変える

ARGF.class#path -> String (18107.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"...

File.absolute_path?(file_name) -> bool (15320.0)

file_name が絶対パスなら true を、そうでなければ false を返します。

...
file
_name が絶対パスなら true を、そうでなければ false を返します。

@param file_name ファイル名を表す文字列を指定します。文字列でない場合は、to_path メソッド、to_str メソッドの順で暗黙の型変換が試みられます。

@raise TypeE...
...ist[例][ruby]{
File
.absolute_path?("//foo/bar\\baz") # => true
File
.absolute_path?("C:foo\\bar") # => false
File
.absolute_path?("~") # => false

# プラットフォームが cygwin、mswin、mingw の場合
File
.absolute_path?("C:\\foo\\bar") # => true
File
.absolute_path?("/foo/...
...bar\\baz") # => false

# プラットフォームが上記以外の場合
File
.absolute_path?("C:\\foo\\bar") # => false
File
.absolute_path?("/foo/bar\\baz") # => true
//}...

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

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

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

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

File
.expand_path と異なり、 file_name 先頭が "~" である場...
...[ruby]{
p Dir.getwd #=> "/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.expand_path(path, default_dir = &#39;.&#39;) -> String (15300.0)

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

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

先頭の ~ はホームディレクトリ(環境変数 HOME が使われます)に、
~USER はそのユーザのホームディレクトリに展開されます。...
...list[例][ruby]{
p Dir.getwd #=> "/home/matz/work/foo"
p ENV["HOME"] #=> "/home/matz"
p File.expand_path("..") #=> "/home/matz/work"
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 を基準に展開されます。...
<< 1 2 3 ... > >>