検索結果
先頭5件
-
FileTest
. # blockdev?(file) -> bool (6119.0) -
ファイルがブロックスペシャルファイルである時に真を返します。 そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。
...す文字列か IO オブジェクトを指定します。
@raise IOError 指定された IO オブジェクト file が既に close されていた場合に発生します。
例:
Dir.glob("/dev/*") { |file|
puts file if FileTest.blockdev?(file)
}
# /dev/disk0
# /dev/disk0s3
# ...... -
FileTest
. # chardev?(file) -> bool (6119.0) -
ファイルがキャラクタスペシャルファイルの時に真を返します。そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。
...表す文字列か IO オブジェクトを指定します。
@raise IOError 指定された IO オブジェクト file が既に close されていた場合に発生します。
例:
Dir.glob("/dev/*") { |file|
puts file if FileTest.chardev?(file)
}
# /dev/console
# /dev/tty
# ...... -
Kernel
. # spawn(env , program , *args , options={}) -> Integer (19.0) -
引数を外部コマンドとして実行しますが、生成した 子プロセスの終了を待ち合わせません。生成した子プロセスのプロセスIDを返します。
...名も指定できます。
//emlist[][ruby]{
pid = spawn(command, :in=>"/dev/null") # read mode
pid = spawn(command, :out=>"/dev/null") # write mode
pid = spawn(command, :err=>"log") # write mode
pid = spawn(command, 3=>"/dev/null") # read mode
//}
stdout と stderr をリダイレクトした場... -
Kernel
. # spawn(program , *args) -> Integer (19.0) -
引数を外部コマンドとして実行しますが、生成した 子プロセスの終了を待ち合わせません。生成した子プロセスのプロセスIDを返します。
...名も指定できます。
//emlist[][ruby]{
pid = spawn(command, :in=>"/dev/null") # read mode
pid = spawn(command, :out=>"/dev/null") # write mode
pid = spawn(command, :err=>"log") # write mode
pid = spawn(command, 3=>"/dev/null") # read mode
//}
stdout と stderr をリダイレクトした場... -
FileUtils
. # cmp(file _ a , file _ b) -> bool (13.0) -
ファイル file_a と file_b の内容が同じなら真を返します。
...ファイル file_a と file_b の内容が同じなら真を返します。
@param file_a ファイル名。
@param file_b ファイル名。
//emlist[][ruby]{
require 'fileutils'
FileUtils.cmp('somefile', 'somefile') #=> true
FileUtils.cmp('/dev/null', '/dev/urandom') #=> false
//}... -
FileUtils
. # compare _ file(file _ a , file _ b) -> bool (13.0) -
ファイル file_a と file_b の内容が同じなら真を返します。
...ファイル file_a と file_b の内容が同じなら真を返します。
@param file_a ファイル名。
@param file_b ファイル名。
//emlist[][ruby]{
require 'fileutils'
FileUtils.cmp('somefile', 'somefile') #=> true
FileUtils.cmp('/dev/null', '/dev/urandom') #=> false
//}... -
FileUtils
. # identical?(file _ a , file _ b) -> bool (13.0) -
ファイル file_a と file_b の内容が同じなら真を返します。
...ファイル file_a と file_b の内容が同じなら真を返します。
@param file_a ファイル名。
@param file_b ファイル名。
//emlist[][ruby]{
require 'fileutils'
FileUtils.cmp('somefile', 'somefile') #=> true
FileUtils.cmp('/dev/null', '/dev/urandom') #=> false
//}... -
Kernel
. # format(format , *arg) -> String (7.0) -
format 文字列を C 言語の sprintf と同じように解釈し、 引数をフォーマットした文字列を返します。
format 文字列を C 言語の sprintf と同じように解釈し、
引数をフォーマットした文字列を返します。
@param format フォーマット文字列です。
@param arg フォーマットされる引数です。
@see Kernel.#printf,Time#strftime,Date.strptime
=== sprintf フォーマット
Ruby の sprintf フォーマットは基本的に C 言語の sprintf(3)
のものと同じです。ただし、short や long などの C 特有の型に対する修飾子が
ないこと、2進数の指示子(%b, %B)が存在すること、s... -
Kernel
. # open(file , mode _ enc = "r" , perm = 0666) -> IO (7.0) -
file をオープンして、IO(Fileを含む)クラスのインスタンスを返します。
...イルを区別する場
合に限ります)
=== Universal Newline
改行をLFに揃えます。一言で言えばPEP:278 https://www.python.org/dev/peps/pep-0278/のことです。
: "rt"
CR、LF、CRLFのいずれをもLFとして読み込む。
: "rb"
CR、LF、CRLFはいずれもそ......とは限りません (例えばパイプ)。
=== Universal Newline
改行をLFに揃えます。一言で言えばPEP:278 https://www.python.org/dev/peps/pep-0278/のことです。
: "rt"
CR、LF、CRLFのいずれをもLFとして読み込む。
: "rb"
CR、LF、CRLFはいずれもそ...