33件ヒット
[1-33件を表示]
(0.031秒)
別のキーワード
検索結果
先頭3件
-
Kernel
. # test(cmd , file1 , file2) -> bool (35.0) -
2ファイル間のファイルテストを行います。
...とみなします。
@param file1 テストするファイルのパスを表す文字列か IO オブジェクトを指定します。
@param file2 テストするファイルのパスを表す文字列か IO オブジェクトを指定します。
@return 真偽値を返します。
以下は cmd......時刻が古い
: ?-
ファイル1とファイル2が同一のファイルである
//emlist[例][ruby]{
IO.write("testfile1", "test1")
IO.write("testfile2", "test2")
%w(= < > -).each do |e|
result = test(e, "testfile1", "testfile2")
puts "#{e}: #{result}"
end
//}
# => =: true
# => <: fals... -
Kernel
$ $ stdin -> object (27.0) -
標準入力です。
...# 入力する
$stdin = STDIN # 元に戻す
//}
ただし、Kernel.#gets など、特定の組み込みメソッドは
$stdin オブジェクトにメソッドを転送して実装されています。
従って、Kernel.#gets などが正しく動作するには、
$stdin オブジェク......d, fileno, to_io, eof, each_line, each_byte,
binmode, closed?
//emlist[例][ruby]{
$stdin = Object.new
def $stdin.gets
"foo"
end
p gets() # => "foo"
//}
自プロセスだけでなく、子プロセスの標準入力もリダイレクトしたいときは
以下のように IO#reopen を使... -
Kernel
. # test(cmd , file) -> bool | Time | Integer | nil (20.0) -
単体のファイルでファイルテストを行います。
...列の場合はその先頭の文字だけをコマンドとみなします。
@param file テストするファイルのパスを表す文字列か IO オブジェクトを指定します。
@return 下表に特に明記していないものは、真偽値を返します。
以下は cmd として......me
: ?A
ファイルの最終アクセス時刻を返す -> Time
: ?C
ファイルの inode 変更時刻を返す -> Time
//emlist[例][ruby]{
IO.write("testfile", "test")
test("r", "testfile") # => true
test("s", "testfile") # => 4
test("M", "testfile") # => 2018-03-31 07:38:40 +0900
//}...