55件ヒット
[1-55件を表示]
(0.015秒)
モジュール
- Kernel (24)
キーワード
-
$ INPUT _ LINE _ NUMBER (12) -
$ NR (12) - CSV (12)
- IO (12)
-
NEWS for Ruby 2
. 6 . 0 (7)
検索結果
-
IO (78.0)
-
基本的な入出力機能のためのクラスです。
...して下さい。
以下がテキスト読み込みメソッドです。
* IO.foreach
* IO.readlines
* IO#each_line
* IO#lines
* IO#gets
* IO#getc
* IO#ungetc
* IO#read
* IO#readchar
* IO#readline
* IO#readlines
バイナリ読み込みメソッドは IO のエンコーディングの......ーディングは常に ASCII-8BIT になります。
以下がバイナリ読み込みメソッドです。
* IO#read(size)
* IO#read_nonblock
* IO#readpartial
* IO#sysread
また書き込みメソッド IO#write も IO のエンコーディングの影響を受けます。
IO のすべて......として動作します。
例:
f = File.open('t.txt', 'r+:euc-jp')
p f.getc.encoding #=> Encoding::EUC_JP
p f.read(1).encoding #=> Encoding::ASCII_8BIT
====[a:io_encoding] IO のエンコーディングとエンコーディングの変......参照して下さい。
以下がテキスト読み込みメソッドです。
* IO.foreach
* IO.readlines
* IO#each_line
* IO#gets
* IO#getc
* IO#ungetc
* IO#read
* IO#readchar
* IO#readline
* IO#readlines
バイナリ読み込みメソッドは IO のエンコーディングの影響... -
CSV (30.0)
-
このクラスは CSV ファイルやデータに対する完全なインターフェイスを提供します。
...,2010
CSV_TEXT
IO.write "sample.csv", csv_text
# ファイルから一行ずつ
CSV.foreach("sample.csv") do |row|
p row
end
# => ["Ruby", "1995"]
# ["Rust", "2010"]
# ファイルから一度に
p CSV.read("sample.csv")
# => [["Ruby", "1995"], ["Rust", "2010"]]
# 文字列から一行ず......ーディング (M17n or Multilingualization)
This new CSV parser is m17n savvy. The parser works in the Encoding of the IO
or String object being read from or written to. Your data is never transcoded
(unless you ask Ruby to transcode it for you) and will literally be parsed in
the Encoding it i......d into CSV have the proper Encoding set and everything should just work.
CSV methods that allow you to open IO objects (CSV::foreach(), CSV::open(),
CSV::read(), and CSV::readlines()) do allow you to specify the Encoding.
One minor exception comes when generating CSV into a String with an Encoding... -
NEWS for Ruby 2
. 6 . 0 (18.0) -
NEWS for Ruby 2.6.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...トを渡すのは非推奨になる予定で、
今は警告が出ます。 14643
* File
* File.read, File.binread, File.write, File.binwrite,
File.foreach, File.readlines はパスがパイプ文字 '|' で始まっていても
外部コマンドを実行しなくなりま......* BigDecimal.new はバージョン 2.0 で削除予定です。
* Pathname
* Pathname#read, Pathname#binread, Pathname#write,
Pathname#binwrite, Pathname#each_line, Pathname#readlines は
パスがパイプ文字 '|' で始まっていても外部コマンドを実行しな......スクリプトが一新されました。
https://github.com/ruby/ruby/pull/1779
* pthread プラットフォームでスレッドキャッシュを有効にしました。
(Thread.new と Thread.start) 14757
* POSIX タイマーのあるプラットフォームでタイマースレ... -
Kernel
$ $ INPUT _ LINE _ NUMBER -> Integer (12.0) -
$. の別名
...$. の別名
1 e
2 f
3 g
4 h
5 i
# end of a.txt
require "English"
File.foreach(ARGV.at(0)){|line|
# read line
}
p $INPUT_LINE_NUMBER
# end of sample.rb
ruby sample.rb a.txt
#=> 5... -
Kernel
$ $ NR -> Integer (12.0) -
$. の別名
...$. の別名
1 e
2 f
3 g
4 h
5 i
# end of a.txt
require "English"
File.foreach(ARGV.at(0)){|line|
# read line
}
p $INPUT_LINE_NUMBER
# end of sample.rb
ruby sample.rb a.txt
#=> 5...