るりまサーチ

最速Rubyリファレンスマニュアル検索!
22件ヒット [1-22件を表示] (0.061秒)
トップページ > クエリ:IO[x] > クエリ:io[x] > クエリ:$stdout[x] > 種類:クラス[x]

別のキーワード

  1. io popen
  2. io pipe
  3. io each
  4. io readlines
  5. io each_line

ライブラリ

キーワード

検索結果

CSV (55.0)

このクラスは CSV ファイルやデータに対する完全なインターフェイスを提供します。

...ターフェイスを提供します。

=== 読み込み

//emlist[][ruby]{
require "csv"

csv_text = <<~CSV_TEXT
Ruby,1995
Rust,2010
CSV_TEXT

IO
.write "sample.csv", csv_text

# ファイルから一行ずつ
CSV.foreach("sample.csv") do |row|
p row
end
# => ["Ruby", "1995"]
# ["Rust", "2...
...csv_out << %w{my data here} } # to $stdout
CSV(csv = "") { |csv_str| csv_str << %w{my data here} } # to a String
CSV($stderr) { |csv_err| csv_err << %w{my data here} } # to $stderr
//}

=== CSV と文字エンコーディング (M17n or Multilingualization)

This new CSV parser is m17n savv...
...y. 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 is in. Thus CSV will return Arrays or Rows of Strings in the
Encoding of your d...

Psych::Stream (39.0)

入力されたオブジェクトから変換された YAML document を指定した IO に出力する機能を持つクラスです。

...YAML document を指定した
IO
に出力する機能を持つクラスです。

start で変換を開始し、push で変換する Ruby オブジェクトを渡し、
最後に finish を呼ぶことで変換を完了します。
stream = Psych::Stream.new($stdout)
stream.start
stream.push...
...は(バッファリングされずに)直接 $stdout に出力されます。

finish を確実に呼び出すためには Psych::Stream#start メソッドを
ブロック付きで呼び出すとよいでしょう。

stream = Psych::Stream.new($stdout)
stream.start do |em|
em.push(:foo =>...