154件ヒット
[1-100件を表示]
(0.023秒)
ライブラリ
- pathname (154)
検索結果
先頭5件
-
Pathname
# fnmatch(pattern , *args) -> bool (124.0) -
File.fnmatch(pattern, self.to_s, *args) と同じです。
...ch(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
# fnmatch?(pattern , *args) -> bool (124.0) -
File.fnmatch?(pattern, self.to_s, *args) と同じです。
...h?(pattern, self.to_s, *args) と同じです。
@param pattern パターンを文字列で指定します。ワイルドカードとして `*', `?', `[]' が使用できま
す。Dir.glob とは違って `{}' や `**/' は使用できません。
@param args File.fnmatch を参照... -
Pathname
# each _ line(*args) -> Enumerator (119.0) -
IO.foreach(self.to_s, *args, &block) と同じです。
...foreach(self.to_s, *args, &block) と同じです。
//emlist[例][ruby]{
require "pathname"
IO.write("testfile", "line1\nline2,\nline3\n")
Pathname("testfile").each_line
# => #<Enumerator: IO:foreach("testfile")>
//}
//emlist[例 ブロックを指定][ruby]{
require "pathname"
IO.write("testfi......le", "line1\nline2,\nline3\n")
Pathname("testfile").each_line {|f| p f }
# => "line1\n"
# => "line2,\n"
# => "line3\n"
//}
//emlist[例 limit を指定][ruby]{
require "pathname"
IO.write("testfile", "line1\nline2,\nline3\n")
Pathname("testfile").each_line(4) {|f| p f }
# => "line"
# => "1\n"
#......=> "line"
# => "2,\n"
# => "line"
# => "3\n"
//}
//emlist[例 sep を指定][ruby]{
require "pathname"
IO.write("testfile", "line1\nline2,\nline3\n")
Pathname("testfile").each_line(",") {|f| p f }
# => "line1\nline2,"
# => "\nline3\n"
//}
@see IO.foreach... -
Pathname
# each _ line(*args) {|line| . . . } -> nil (119.0) -
IO.foreach(self.to_s, *args, &block) と同じです。
...foreach(self.to_s, *args, &block) と同じです。
//emlist[例][ruby]{
require "pathname"
IO.write("testfile", "line1\nline2,\nline3\n")
Pathname("testfile").each_line
# => #<Enumerator: IO:foreach("testfile")>
//}
//emlist[例 ブロックを指定][ruby]{
require "pathname"
IO.write("testfi......le", "line1\nline2,\nline3\n")
Pathname("testfile").each_line {|f| p f }
# => "line1\n"
# => "line2,\n"
# => "line3\n"
//}
//emlist[例 limit を指定][ruby]{
require "pathname"
IO.write("testfile", "line1\nline2,\nline3\n")
Pathname("testfile").each_line(4) {|f| p f }
# => "line"
# => "1\n"
#......=> "line"
# => "2,\n"
# => "line"
# => "3\n"
//}
//emlist[例 sep を指定][ruby]{
require "pathname"
IO.write("testfile", "line1\nline2,\nline3\n")
Pathname("testfile").each_line(",") {|f| p f }
# => "line1\nline2,"
# => "\nline3\n"
//}
@see IO.foreach... -
Pathname
# binread(*args) -> String | nil (118.0) -
IO.binread(self.to_s, *args)と同じです。
...read(self.to_s, *args)と同じです。
//emlist[例][ruby]{
require "pathname"
pathname = Pathname("testfile")
pathname.binread # => "This is line one\nThis is line two\nThis is line three\nAnd so on...\n"
pathname.binread(20) # => "This is line one\nThi"
pathname.binread(20, 10)... -
Pathname
# mkdir(*args) -> 0 (118.0) -
Dir.mkdir(self.to_s, *args) と同じです。
...Dir.mkdir(self.to_s, *args) と同じです。
@see Dir.mkdir... -
Pathname
# read(*args) -> String | nil (118.0) -
IO.read(self.to_s, *args)と同じです。
...IO.read(self.to_s, *args)と同じです。
@see IO.read... -
Pathname
# readlines(*args) -> [String] (118.0) -
IO.readlines(self.to_s, *args)と同じです。
...IO.readlines(self.to_s, *args)と同じです。
@see IO.readlines... -
Pathname
# sysopen(*args) -> Integer (118.0) -
IO.sysopen(self.to_s, *args)と同じです。
...IO.sysopen(self.to_s, *args)と同じです。
@see IO.sysopen... -
Pathname
# join(*args) -> Pathname (108.0) -
与えられたパス名を連結します。
...を連結します。
@param args 連結したいディレクトリ名やファイル名を文字列で与えます。
//emlist[例][ruby]{
require "pathname"
path0 = Pathname("/usr") # Pathname:/usr
path0 = path0.join("bin/ruby") # Pathname:/usr/bin/ruby
# 上記の p......ath0 の処理は下記の path1 と同様のパスになります
path1 = Pathname("/usr") + "bin/ruby" # Pathname:/usr/bin/ruby
path0 == path1 #=> true
//}...