るりまサーチ

最速Rubyリファレンスマニュアル検索!
918件ヒット [201-300件を表示] (0.111秒)

別のキーワード

  1. _builtin to_r
  2. open3 pipeline_r
  3. matrix elements_to_r
  4. fileutils rm_r
  5. bigdecimal to_r

ライブラリ

モジュール

キーワード

検索結果

<< < 1 2 3 4 5 ... > >>

File::Stat#birthtime -> Time (6119.0)

作成された時刻を返します。

...ます。

@raise NotImplementedError Windows のような birthtime のない環境で発生します。

//emlist[][ruby]{
File.write("testfile", "foo")
sleep 10
File.write("testfile", "bar")
sleep 10
File.chmod(0644, "testfile")
sleep 10
File.read("testfile")
File.stat("testfile").birthtime #=...

IO#close_read -> nil (6119.0)

読み込み用の IO を close します。主にパイプや読み書き両用に作成し た IO オブジェクトで使用します。

...す。


@raise IOError 自身が読み込み用にオープンされていなければ発生します。

@raise Errno::EXXX close に失敗した場合に発生します。

//emlist[例][ruby]{
IO.popen("/bin/sh","r+") do |f|
f.close_read
# f.readlines # => IOError: not opened for reading
end...
...//}

@see IO#close, IO#closed?, IO#close_write...
...す。

@raise IOError 自身が読み込み用にオープンされていなければ発生します。

@raise Errno::EXXX close に失敗した場合に発生します。

//emlist[例][ruby]{
IO.popen("/bin/sh","r+") do |f|
f.close_read
# f.readlines # => IOError: not opened for reading
end...

IO#reopen(path) -> self (6119.0)

path で指定されたファイルにストリームを繋ぎ換えます。

...どはリセットされます。

@param path パスを表す文字列を指定します。

@param mode パスを開く際のモードを文字列で指定します。

@raise Errno::EXXX 失敗した場合に発生します。

//emlist[例][ruby]{
IO.write("testfile", "This is line one\nThis is...
...f1.print("This is line three\n")
f2.readlines # => ["This is line one\n", "This is line two\n"]
f1.close
f2.reopen("testfile", "r") # => #<File:testfile>
f2.readlines # => ["This is line one\n", "This is line two\n", "This is line three\n"]
f2.close
//}

@see Kernel.#...

IO#reopen(path, mode) -> self (6119.0)

path で指定されたファイルにストリームを繋ぎ換えます。

...どはリセットされます。

@param path パスを表す文字列を指定します。

@param mode パスを開く際のモードを文字列で指定します。

@raise Errno::EXXX 失敗した場合に発生します。

//emlist[例][ruby]{
IO.write("testfile", "This is line one\nThis is...
...f1.print("This is line three\n")
f2.readlines # => ["This is line one\n", "This is line two\n"]
f1.close
f2.reopen("testfile", "r") # => #<File:testfile>
f2.readlines # => ["This is line one\n", "This is line two\n", "This is line three\n"]
f2.close
//}

@see Kernel.#...

Rake::FileList#egrep(pattern) {|filename, count, line| ... } (6119.0)

与えられたパターンをファイルリストから grep のように検索します。

...与えられたパターンをファイルリストから grep のように検索します。

ブロックが与えられた場合は、マッチした行の情報 (ファイル名、行番号、マッチした行) が
ブロックに渡されてブロックが評価されます。ブロックが...
...行を出力します。

@param pattern 正規表現を指定します。

//emlist[][ruby]{
# Rakefile での記載例とする

IO.write("sample1", "line1\nline2\nline3\n")
IO.write("sample2", "line1\nline2\nline3\nline4\n")

task default: :test_rake_app
task :test_rake_app do

file_list = File...
...List.new('sample*')
file_list.egrep(/line/) # => 7

file_list.egrep(/.*/) do |filename, count, line|
"filename = #{filename}, count = #{count}, line = #{line}"
end
end

# => "filename = sample1, count = 1, line = line1\n"
# => "filename = sample1, count = 2, line = line2\n"
# => "filename...

絞り込み条件を変える

Rake::FileList#excluded_from_list?(file_name) -> bool (6119.0)

与えられたファイル名が除外される場合は、真を返します。 そうでない場合は偽を返します。

...param file_name ファイル名を指定します。

//emlist[][ruby]{
# Rakefile での記載例とする

IO.write("test1.rb", "test")
IO.write("test2.rb", "test")

task default: :test_rake_app
task :test_rake_app do
file_list = FileList.new("test1.rb", "test2.rb")
file_list.exclude("test1.rb...
...")
file_list.excluded_from_list?("test1.rb") # => true
file_list.excluded_from_list?("test2.rb") # => false
end
//}...

Rake::FileList#import(array) -> self (6119.0)

与えられた配列を自身にインポートします。

...

@param array ファイル名のリストを指定します。

//emlist[][ruby]{
# Rakefile での記載例とする

IO.write("test1.rb", "test")
IO.write("test2.rb", "test")

task default: :test_rake_app
task :test_rake_app do
file_list = FileList.new("test1.rb", "test2.rb", "test3.rb")
f...
...ile_list.import(["test4.rb", "test5.rb"]) # => ["test4.rb", "test5.rb", "test1.rb", "test2.rb", "test3.rb"]
file_list # => ["test4.rb", "test5.rb", "test1.rb", "test2.rb", "test3.rb"]
end
//}...

File#truncate(length) -> 0 (6113.0)

ファイルのサイズを最大 length バイトにします。

...失敗した場合は例外
Errno::EXXX が発生します。

@raise IOError 自身が書き込み用にオープンされていなければ発生します。

@raise Errno::EXXX サイズの変更に失敗した場合に発生します。

//emlist[例][ruby]{
IO.write("testfile", "1234567890")
Fi...
...le.open("testfile", "a") do |f|
f.truncate(5) # => 0
f.size # => 5
end
//}...

IO#external_encoding -> Encoding | nil (6113.0)

IO の外部エンコーディングを返します。 外部エンコーディングが指定されていない場合は nil を返します。 ただし読み込み専用モードの場合は Encoding.default_external になります。

...ディングが指定されていない場合は nil を返します。
ただし読み込み専用モードの場合は Encoding.default_external になります。

//emlist[例][ruby]{
IO.write("testfile", "abcde")
File.open("testfile") { |f| p f.external_encoding } # => #<Encoding:UTF-8>
//}...

IO#internal_encoding -> Encoding | nil (6113.0)

IO の内部エンコーディングを返します。 内部エンコーディングが指定されていない場合は nil を返します。

...エンコーディングが指定されていない場合は nil を返します。

//emlist[例][ruby]{
IO.write("testfile", "abcde")
File.open("testfile") do |f|
p f.internal_encoding # => nil
f.set_encoding("ASCII-8BIT", "EUC-JP")
p f.internal_encoding # => #<Encoding:EUC-JP>
end
//}...

絞り込み条件を変える

<< < 1 2 3 4 5 ... > >>