るりまサーチ

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

別のキーワード

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

ライブラリ

クラス

キーワード

検索結果

<< 1 2 > >>

Pathname#to_s -> String (21132.0)

パス名を文字列で返します。

...パス名を文字列で返します。


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

path
= Pathname.new("/tmp/hogehoge")
File
.open(path)
//}...

Pathname#expand_path(default_dir = &#39;.&#39;) -> Pathname (9322.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#basename(suffix = "") -> Pathname (3307.0)

Pathname.new(File.basename(self.to_s, suffix)) と同じです。

...Pathname.new(File.basename(self.to_s, suffix)) と同じです。

@param suffix サフィックスを文字列で与えます。'.*' という文字列を与えた場合、'*' はワイルドカードとして働き
'.' を含まない任意の文字列にマッチします。

//emli...
...][ruby]{
require "pathname"

Path
name("ruby/ruby.c").basename #=> #<Pathname:"ruby.c">
Path
name("ruby/ruby.c").basename(".c") #=> #<Pathname:"ruby">
Path
name("ruby/ruby.c").basename(".*") #=> #<Pathname:"ruby">
Path
name("ruby/ruby.exe").basename(".*") #=> #<Pathname:"ruby">
Path
name(...
..."ruby/y.tab.c").basename(".*") #=> #<Pathname:"y.tab">
//}

@see File.basename...

Pathname#dirname -> Pathname (3151.0)

Pathname.new(File.dirname(self.to_s)) と同じです。

...Pathname.new(File.dirname(self.to_s)) と同じです。

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

Path
name('/usr/bin/shutdown').dirname # => #<Pathname:/usr/bin>
//}

@see File.dirname...

Pathname#fnmatch(pattern, *args) -> bool (3087.0)

File.fnmatch(pattern, self.to_s, *args) と同じです。

...File.fnmatch(pattern, self.to_s, *args) と同じです。

@param pattern パターンを文字列で指定します。ワイルドカードとして `*', `?', `[]' が使用できま
す。Dir.glob とは違って `{}' や `**/' は使用できません。

@param args File.fnmatch...
...を参照してください。

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

path
= Pathname("testfile")
path
.fnmatch("test*") # => true
path
.fnmatch("TEST*") # => false
path
.fnmatch("TEST*", File::FNM_CASEFOLD) # => true
//}

@see File.fnmatch...

絞り込み条件を変える

Pathname#split -> Array (3063.0)

File.split(self.to_s) と同じです。

...File.split(self.to_s) と同じです。

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

path
name = Pathname("/path/to/sample")
path
name.split # => [#<Pathname:/path/to>, #<Pathname:sample>]
//}

@see File.split...

Pathname#chown(owner, group) -> Integer (3057.0)

File.chown(owner, group, self.to_s) と同じです。

...File.chown(owner, group, self.to_s) と同じです。

@param owner オーナーを指定します。

@param group グループを指定します。

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

Path
name('testfile').stat.uid # => 501
Path
name('testfile').chown(502, 12)
Path
name('testfile').stat.ui...
...d # => 502
//}

@see File.chown, File#chown...

Pathname#atime -> Time (3051.0)

File.atime(self.to_s) を渡したものと同じです。

...File.atime(self.to_s) を渡したものと同じです。

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

path
name = Pathname("testfile")
path
name.atime # => 2018-12-18 20:58:13 +0900
//}

@see File.atime...

Pathname#ctime -> Time (3051.0)

File.ctime(self.to_s) を渡したものと同じです。

...File.ctime(self.to_s) を渡したものと同じです。

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

IO.write("testfile", "test")
path
name = Pathname("testfile")
path
name.ctime # => 2019-01-14 00:39:51 +0900
sleep 1
path
name.chmod(0755)
path
name.ctime # => 2019-01-14 00:39:52 +0900
//}

@see File.ct...
<< 1 2 > >>