228件ヒット
[1-100件を表示]
(0.134秒)
別のキーワード
検索結果
先頭5件
-
IO
. write(path , string , **opts) -> Integer (24451.0) -
path で指定されるファイルを開き、string を書き込み、 閉じます。
...path で指定されるファイルを開き、string を書き込み、
閉じます。
Kernel.#open と同様 path の先頭が "|" ならば、"|" に続くコマンドを実行し、コマンドの出力を標準出力に書き込みます。
offset を指定するとその位置までシー......offset を指定しないと、書き込みの末尾でファイルを
切り捨てます。
キーワード引数はファイルを開くときに使われ、エンコーディングなどを指定することができます。
詳しくは IO.open を見てください。
@param path ファイ......am string 書き込む文字列
@param offset 書き込み開始位置
@param opts ファイルを開くときのキーワード引数
//emlist[例][ruby]{
text = "This is line one\nThis is line two\nThis is line three\nAnd so on...\n"
IO.write("testfile", text) # => 66
IO.write("testf... -
IO
. write(path , string , offset=nil , **opts) -> Integer (24451.0) -
path で指定されるファイルを開き、string を書き込み、 閉じます。
...path で指定されるファイルを開き、string を書き込み、
閉じます。
Kernel.#open と同様 path の先頭が "|" ならば、"|" に続くコマンドを実行し、コマンドの出力を標準出力に書き込みます。
offset を指定するとその位置までシー......offset を指定しないと、書き込みの末尾でファイルを
切り捨てます。
キーワード引数はファイルを開くときに使われ、エンコーディングなどを指定することができます。
詳しくは IO.open を見てください。
@param path ファイ......am string 書き込む文字列
@param offset 書き込み開始位置
@param opts ファイルを開くときのキーワード引数
//emlist[例][ruby]{
text = "This is line one\nThis is line two\nThis is line three\nAnd so on...\n"
IO.write("testfile", text) # => 66
IO.write("testf... -
IO
. binwrite(path , string , offset=nil) -> Integer (12448.0) -
path で指定されるファイルを開き、string を書き込み、 閉じます。
...path で指定されるファイルを開き、string を書き込み、
閉じます。
ファイルを開くときの mode が "rb:ASCII-8BIT" で、バイナリモードが有効
である点以外は IO.write と同じです。
Kernel.#open と同様 path の先頭が "|" ならば、"|" に......offset を指定するとその位置までシークします。
offset を指定しないと、書き込みの末尾でファイルを
切り捨てます。
@param path ファイル名文字列
@param string 書き込む文字列
@param offset 書き込み開始位置
//emlist[例][ruby]{
# 8x......ADklEQVQIW2P4DwUMlDEA98A/wTjP
QBoAAAAASUVORK5CYII='.unpack('m').first
# 期待する先頭16バイトの16進ダンプ: どの環境でも同じ。
puts png[0...16].unpack('C*').map {|c| '%02x' % c }.join(' ')
# => 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52
# binwriteを使用した場合:... -
StringIO
. new(string = & # 39;& # 39; , mode = & # 39;r+& # 39;) -> StringIO (6446.0) -
StringIO オブジェクトを生成して返します。
...
StringIO オブジェクトを生成して返します。
与えられた string がフリーズされている場合には、mode はデフォルトでは読み取りのみに設定されます。
ブロックを与えた場合は生成した StringIO オブジェクトを引数としてブロッ......価してその結果を返します。
@param string 生成される StringIO のデータを文字列で指定します。
この文字列はバッファとして使われます。StringIO#write などによって、
string 自身も書き換えられます。
@param......整数で指定します。
@raise Errno::EACCES string がフリーズされていて、mode が書き込み可能に設定されている場合に発生します。
//emlist[例][ruby]{
require 'stringio'
s = "foo"
io = StringIO.new(s)
p io.getc # => 102
p io.pos # => 1
p io.size... -
StringIO
. open(string = & # 39;& # 39; , mode = & # 39;r+& # 39;) -> StringIO (6446.0) -
StringIO オブジェクトを生成して返します。
...
StringIO オブジェクトを生成して返します。
与えられた string がフリーズされている場合には、mode はデフォルトでは読み取りのみに設定されます。
ブロックを与えた場合は生成した StringIO オブジェクトを引数としてブロッ......価してその結果を返します。
@param string 生成される StringIO のデータを文字列で指定します。
この文字列はバッファとして使われます。StringIO#write などによって、
string 自身も書き換えられます。
@param......整数で指定します。
@raise Errno::EACCES string がフリーズされていて、mode が書き込み可能に設定されている場合に発生します。
//emlist[例][ruby]{
require 'stringio'
s = "foo"
io = StringIO.new(s)
p io.getc # => 102
p io.pos # => 1
p io.size... -
StringIO
. open(string = & # 39;& # 39; , mode = & # 39;r+& # 39;) {|io| . . . } -> object (6246.0) -
StringIO オブジェクトを生成して返します。
...
StringIO オブジェクトを生成して返します。
与えられた string がフリーズされている場合には、mode はデフォルトでは読み取りのみに設定されます。
ブロックを与えた場合は生成した StringIO オブジェクトを引数としてブロッ......価してその結果を返します。
@param string 生成される StringIO のデータを文字列で指定します。
この文字列はバッファとして使われます。StringIO#write などによって、
string 自身も書き換えられます。
@param......整数で指定します。
@raise Errno::EACCES string がフリーズされていて、mode が書き込み可能に設定されている場合に発生します。
//emlist[例][ruby]{
require 'stringio'
s = "foo"
io = StringIO.new(s)
p io.getc # => 102
p io.pos # => 1
p io.size... -
CSV
. filter(input , options = Hash . new) {|row| . . . } (6149.0) -
このメソッドは CSV データに対して Unix のツール群のようなフィルタを構築 するのに便利です。
...全て output に書き込
みます。
@param input String か IO のインスタンスを指定します。
デフォルトは ARGF です。
@param output String か IO のインスタンスを指定します。
デフォルトは $stdout です。
@param options ":i......n_", ":input_" で始まるキーは input にだけ適用されます。
":out_", ":output_" で始まるキーは output にだけ適用されます。
それ以外のキーは両方に適用されます。
":output_row_sep" のデフォルト値は $/......//emlist[例: input, output は初期値][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
r... -
CSV
. filter(input , output , options = Hash . new) {|row| . . . } (6149.0) -
このメソッドは CSV データに対して Unix のツール群のようなフィルタを構築 するのに便利です。
...全て output に書き込
みます。
@param input String か IO のインスタンスを指定します。
デフォルトは ARGF です。
@param output String か IO のインスタンスを指定します。
デフォルトは $stdout です。
@param options ":i......n_", ":input_" で始まるキーは input にだけ適用されます。
":out_", ":output_" で始まるキーは output にだけ適用されます。
それ以外のキーは両方に適用されます。
":output_row_sep" のデフォルト値は $/......//emlist[例: input, output は初期値][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
r... -
CSV
. filter(options = Hash . new) {|row| . . . } (6149.0) -
このメソッドは CSV データに対して Unix のツール群のようなフィルタを構築 するのに便利です。
...全て output に書き込
みます。
@param input String か IO のインスタンスを指定します。
デフォルトは ARGF です。
@param output String か IO のインスタンスを指定します。
デフォルトは $stdout です。
@param options ":i......n_", ":input_" で始まるキーは input にだけ適用されます。
":out_", ":output_" で始まるキーは output にだけ適用されます。
それ以外のキーは両方に適用されます。
":output_row_sep" のデフォルト値は $/......//emlist[例: input, output は初期値][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
r...