種類
- 特異メソッド (48)
- インスタンスメソッド (36)
- 文書 (24)
クラス
-
ARGF
. class (36) - CSV (48)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) -
NEWS for Ruby 2
. 0 . 0 (12) - filter (36)
- new (12)
-
to
_ io (12) -
to
_ write _ io (12)
検索結果
先頭5件
-
ARGF
. class # write(str) -> Integer (21119.0) -
処理対象のファイルに対して str を出力します。 str が文字列でなければ to_s による文字列化を試みます。 実際に出力できたバイト数を返します。
...して str を出力します。
str が文字列でなければ to_s による文字列化を試みます。
実際に出力できたバイト数を返します。
c:ARGF#inplace時にのみ使用できます。
@param str 出力する文字列を指定します。
@see ARGF.class#to_write_io... -
ARGF
. class # to _ write _ io -> IO (9119.0) -
処理対象のファイルへの書き出し用 IO オブジェクトを返します。
...処理対象のファイルへの書き出し用 IO オブジェクトを返します。
c:ARGF#inplace時以外は読み込み用の IO オブジェクトを返します。
このため ARGF.class#write などの書き出し用メソッドを呼ぶと IOError が発生します。... -
ARGF
. class # to _ io -> IO (3046.0) -
ARGFが現在開いているファイルのFile、またはIOオブジェクトを 返します。
...
ARGFが現在開いているファイルのFile、またはIOオブジェクトを
返します。
ARGF.to_io # => #<File:glark.txt>
ARGF.to_io # => #<IO:<STDIN>>
@see ARGF.class#file, ARGF.class#to_write_io... -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (66.0) -
1.6.8から1.8.0への変更点(まとめ) * ((<1.6.8から1.8.0への変更点(まとめ)/インタプリタの変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたクラス/モジュール>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたメソッド>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加された定数>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張されたクラス/メソッド(互換性のある変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/変更されたクラス/メソッド(互換性のない変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/文法の変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/正規表現>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Marshal>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Windows 対応>)) * ((<1.6.8から1.8.0への変更点(まとめ)/廃止された(される予定の)機能>)) * ((<1.6.8から1.8.0への変更点(まとめ)/ライブラリ>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張ライブラリAPI>)) * ((<1.6.8から1.8.0への変更点(まとめ)/バグ修正>)) * ((<1.6.8から1.8.0への変更点(まとめ)/サポートプラットフォームの追加>))
...derr に変更されました。($deferr はすぐに obsolete に
なりました。$stderr を使ってください)
=== ARGF
: ((<ARGF/ARGF.path>)) [new]
追加 (ARGF.filename の別名) ((<ruby-dev:20197>))
=== Array
: ((<Array#transpose|Array/transpose>)) [new]
追加
: ((<Array#zi......oat (TypeError)
from -:1
ruby 1.7.3 (2002-09-02) [i586-linux]
=== ARGF
: ((<ARGF#to_s|ARGF/to_s>)) [change]
結果は "ARGF" 固定になりました。ファイル名は ARGF.path で取得します。
=== ARGV
: ((<組み込み定数/ARGV>)) [change]
ARGV の......りますが、こちらは未修正です。
((<ruby-dev:19299>))
: ((<IO#putc|IO/putc>)) [bug]
出力メソッドのうち putc だけが write メソッドを使用していませんでした。
((<ruby-dev:18038>))
: IO#read, gets ..., etc. [bug]
File::NONBLOCK を指定した IO の... -
NEWS for Ruby 2
. 0 . 0 (54.0) -
NEWS for Ruby 2.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...* '_' で始まる使用されていない変数は警告しなくなりました
=== 組み込みクラスの更新
* ARGF.class
* 追加: ARGF.class#codepoints, ARGF.class#each_codepoint
IO にある同名のメソッドに対応します
* Array
* 追加: Array#bsearch 二......ていればブレースを展開します
* GC
* 改良:
* ビットマップマーキングを導入しました。Copy-on-Write を使用してページをコピーするのでメモリ使用量が減少します
* 非再帰的なマーキングを導入しました。......th_index(1) {|line, lineno| ... } # このように each_line に置き換える
//}
* IO#lines, IO#chars, IO#codepoints, IO#bytes, ARGF#lines, ARGF#chars,
ARGF#bytes, StringIO#lines, StringIO#chars, StringIO#codepoints, StringIO#bytes,
Zlib::GzipReader#lines, Zlib::GzipReader#bytes
*... -
CSV
. filter(input , options = Hash . new) {|row| . . . } (24.0) -
このメソッドは CSV データに対して Unix のツール群のようなフィルタを構築 するのに便利です。
...行を全て output に書き込
みます。
@param input String か IO のインスタンスを指定します。
デフォルトは ARGF です。
@param output String か IO のインスタンスを指定します。
デフォルトは $stdout です。
@param optio......][ruby]{
# $ echo "header1,header2\nrow1_1,row1_2" > in.csv; ruby test.rb in.csv
require "csv"
options = { headers: true, return_headers: true, write_headers: true }
CSV.filter(options) do |row|
if row.header_row?
row << "header3"
next
end
row << "row1_3"
end
# => header1,header2,h......<<EOS
id,first name,last name,age
1,taro,tanaka,20
2,jiro,suzuki,18
3,ami,sato,19
4,yumi,adachi,21
EOS
File.write('test.csv',content)
options = { headers: true, return_headers: true, write_headers: true }
CSV.filter(File.open("test.csv"), File.open("out.csv", "w"), options) do |row|
if row.head... -
CSV
. filter(input , output , options = Hash . new) {|row| . . . } (24.0) -
このメソッドは CSV データに対して Unix のツール群のようなフィルタを構築 するのに便利です。
...行を全て output に書き込
みます。
@param input String か IO のインスタンスを指定します。
デフォルトは ARGF です。
@param output String か IO のインスタンスを指定します。
デフォルトは $stdout です。
@param optio......][ruby]{
# $ echo "header1,header2\nrow1_1,row1_2" > in.csv; ruby test.rb in.csv
require "csv"
options = { headers: true, return_headers: true, write_headers: true }
CSV.filter(options) do |row|
if row.header_row?
row << "header3"
next
end
row << "row1_3"
end
# => header1,header2,h......<<EOS
id,first name,last name,age
1,taro,tanaka,20
2,jiro,suzuki,18
3,ami,sato,19
4,yumi,adachi,21
EOS
File.write('test.csv',content)
options = { headers: true, return_headers: true, write_headers: true }
CSV.filter(File.open("test.csv"), File.open("out.csv", "w"), options) do |row|
if row.head... -
CSV
. filter(options = Hash . new) {|row| . . . } (24.0) -
このメソッドは CSV データに対して Unix のツール群のようなフィルタを構築 するのに便利です。
...行を全て output に書き込
みます。
@param input String か IO のインスタンスを指定します。
デフォルトは ARGF です。
@param output String か IO のインスタンスを指定します。
デフォルトは $stdout です。
@param optio......][ruby]{
# $ echo "header1,header2\nrow1_1,row1_2" > in.csv; ruby test.rb in.csv
require "csv"
options = { headers: true, return_headers: true, write_headers: true }
CSV.filter(options) do |row|
if row.header_row?
row << "header3"
next
end
row << "row1_3"
end
# => header1,header2,h......<<EOS
id,first name,last name,age
1,taro,tanaka,20
2,jiro,suzuki,18
3,ami,sato,19
4,yumi,adachi,21
EOS
File.write('test.csv',content)
options = { headers: true, return_headers: true, write_headers: true }
CSV.filter(File.open("test.csv"), File.open("out.csv", "w"), options) do |row|
if row.head... -
CSV
. new(data , options = Hash . new) -> CSV (18.0) -
このメソッドは CSV ファイルを読み込んだり、書き出したりするために String か IO のインスタンスをラップします。
...d even if it occurs in a quoted field, assuming that you
would have the same line endings there. If none of those sequences is
found, +data+ is ARGF, Object::STDIN, Object::STDOUT, or
Object::STDERR, or the stream is only available for output, the default
$INPUT_RECORD_SEPARATOR ($/) is u......無視します。真を指定すると、ヘッダ行を
ヘッダと値が同一の CSV::Row のインスタンスとして返します。
: :write_headers
真を指定して :headers にも値をセットすると、ヘッダを出力します。
: :header_converters
:converters オプシ......込み][ruby]{
require "csv"
users =<<-EOS
id,first name,last name,age
1,taro,tanaka,20
2,jiro,suzuki,18
3,ami,sato,19
4,yumi,adachi,21
EOS
File.write("test.csv", users)
File.open("test.csv", "r") do |f|
csv = CSV.new(f, headers: true)
csv.class # => CSV
csv.first # => #<CSV::Row "id":"1" "...