るりまサーチ

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

別のキーワード

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

ライブラリ

クラス

キーワード

検索結果

Pathname.new(path) -> Pathname (39243.0)

文字列 path を元に Pathname オブジェクトを生成します。

...文字列 path を元に Pathname オブジェクトを生成します。

@param path 文字列、または類似のオブジェクトを与えます。
実際には to_str に反応するオブジェクトなら何でも構いません。

@raise ArgumentError path が \0 を含んで...
...いると発生します。

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

Pathname
.new(__FILE__) # => #<Pathname:/path/to/file.rb>
//}...

Pathname.getwd -> Pathname (21169.0)

カレントディレクトリを元に Pathname オブジェクトを生成します。 Pathname.new(Dir.getwd) と同じです。

...カレントディレクトリを元に Pathname オブジェクトを生成します。
Pathname
.new(Dir.getwd) と同じです。

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

Pathname
.getwd #=> #<Pathname:/home/zzak/projects/ruby>
//}

@see Dir.getwd...

Pathname.pwd -> Pathname (21169.0)

カレントディレクトリを元に Pathname オブジェクトを生成します。 Pathname.new(Dir.getwd) と同じです。

...カレントディレクトリを元に Pathname オブジェクトを生成します。
Pathname
.new(Dir.getwd) と同じです。

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

Pathname
.getwd #=> #<Pathname:/home/zzak/projects/ruby>
//}

@see Dir.getwd...

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

指定されたファイル名を文字列で返します。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/p...