るりまサーチ (Ruby 2.6.0)

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

別のキーワード

  1. _builtin |
  2. ipaddr |
  3. set |
  4. integer |
  5. array |

ライブラリ

クラス

モジュール

キーワード

検索結果

CSV#headers -> Array | true | nil (54985.0)

nil を返した場合は、ヘッダは使用されません。 真を返した場合は、ヘッダを使用するが、まだ読み込まれていません。 配列を返した場合は、ヘッダは既に読み込まれています。

nil を返した場合は、ヘッダは使用されません。
真を返した場合は、ヘッダを使用するが、まだ読み込まれていません。
配列を返した場合は、ヘッダは既に読み込まれています。

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

csv = CSV.new("header1,header2\nrow1_1,row1_2")
csv.headers # => nil
csv = CSV.new("header1,header2\nrow1_1,row1_2", headers: true)
csv.headers # => true
csv.read
csv.headers # =>...

CSV#write_headers? -> bool (18505.0)

ヘッダを出力先に書き込む場合は真を返します。 そうでない場合は偽を返します。

ヘッダを出力先に書き込む場合は真を返します。
そうでない場合は偽を返します。

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

csv = CSV.new("date1,date2\n2018-07-09,2018-07-10")
csv.write_headers? # => nil

header = ["header1", "header2"]
row = ["row1_1", "row1_2"]
result = CSV.generate(headers: header, write_headers: false) do |csv|
csv.write_hea...

Kernel#check_signedness(type, headers = nil, opts = nil) -> "signed" | "unsigned" | nil (970.0)

Returns the signedness of the given +type+. You may optionally specify additional +headers+ to search in for the +type+. If the +type+ is found and is a numeric type, a macro is passed as a preprocessor constant to the compiler using the +type+ name, in uppercase, prepended with 'SIGNEDNESS_OF_', followed by the +type+ name, followed by '=X' where 'X' is positive integer if the +type+ is unsigned, or negative integer if the +type+ is signed. For example, if size_t is defined as unsigned, then check_signedness('size_t') would returned +1 and the SIGNEDNESS_OF_SIZE_T=+1 preprocessor macro would be passed to the compiler, and SIGNEDNESS_OF_INT=-1 if check_signedness('int') is done.

Returns the signedness of the given +type+. You may optionally
specify additional +headers+ to search in for the +type+.

If the +type+ is found and is a numeric type, a macro is passed as a
preprocessor constant to the compiler using the +type+ name, in
uppercase, prepended with 'SIGNEDNESS...

Kernel#check_signedness(type, headers = nil, opts = nil) { ... } -> "signed" | "unsigned" | nil (970.0)

Returns the signedness of the given +type+. You may optionally specify additional +headers+ to search in for the +type+. If the +type+ is found and is a numeric type, a macro is passed as a preprocessor constant to the compiler using the +type+ name, in uppercase, prepended with 'SIGNEDNESS_OF_', followed by the +type+ name, followed by '=X' where 'X' is positive integer if the +type+ is unsigned, or negative integer if the +type+ is signed. For example, if size_t is defined as unsigned, then check_signedness('size_t') would returned +1 and the SIGNEDNESS_OF_SIZE_T=+1 preprocessor macro would be passed to the compiler, and SIGNEDNESS_OF_INT=-1 if check_signedness('int') is done.

Returns the signedness of the given +type+. You may optionally
specify additional +headers+ to search in for the +type+.

If the +type+ is found and is a numeric type, a macro is passed as a
preprocessor constant to the compiler using the +type+ name, in
uppercase, prepended with 'SIGNEDNESS...

Kernel#check_sizeof(type, headers = nil) -> Integer | nil (634.0)

与えられた型のサイズを返します。

与えられた型のサイズを返します。

型 type がシステムに存在する場合は、グローバル変数 $defs に
"-DSIZEOF_type=X" を追加し、型のサイズを返します。型 type がシステムに
存在しない場合は、nil を返します。

例えば、

require 'mkmf'
check_sizeof('mystruct') # => 12

である場合、SIZEOF_MYSTRUCT=12 というプリプロセッサマクロをコンパイラに渡します。

@param type 検査したい型を指定します。

@param headers 追加のヘッダファイルを指定します。

絞り込み条件を変える

Kernel#check_sizeof(type, headers = nil) { ... } -> Integer | nil (634.0)

与えられた型のサイズを返します。

与えられた型のサイズを返します。

型 type がシステムに存在する場合は、グローバル変数 $defs に
"-DSIZEOF_type=X" を追加し、型のサイズを返します。型 type がシステムに
存在しない場合は、nil を返します。

例えば、

require 'mkmf'
check_sizeof('mystruct') # => 12

である場合、SIZEOF_MYSTRUCT=12 というプリプロセッサマクロをコンパイラに渡します。

@param type 検査したい型を指定します。

@param headers 追加のヘッダファイルを指定します。

Kernel#try_constant(const, headers = nil, opt = "") -> Integer | nil (634.0)

定数 const がシステムに存在するかどうか検査します。 Kernel#have_const を使ってください。

定数 const がシステムに存在するかどうか検査します。
Kernel#have_const を使ってください。

@param const C 言語の定数名を指定します。

@param headers 追加のヘッダファイルを指定します。

@param opt コンパイラに渡すオプションを指定します。
$CFLAGS もコンパイラには渡されます。

@return 定数 const がシステムに存在する場合はその値を返します。
定数 const がシステムに存在しない場合は nil を返します。

Kernel#try_constant(const, headers = nil, opt = "") { ... } -> Integer | nil (634.0)

定数 const がシステムに存在するかどうか検査します。 Kernel#have_const を使ってください。

定数 const がシステムに存在するかどうか検査します。
Kernel#have_const を使ってください。

@param const C 言語の定数名を指定します。

@param headers 追加のヘッダファイルを指定します。

@param opt コンパイラに渡すオプションを指定します。
$CFLAGS もコンパイラには渡されます。

@return 定数 const がシステムに存在する場合はその値を返します。
定数 const がシステムに存在しない場合は nil を返します。

CSV#col_sep -> String (418.0)

カラム区切り文字列として使用する文字列を返します。

カラム区切り文字列として使用する文字列を返します。

//emlist[例][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

csv = CSV.new(users, headers: true, col_sep: "|")
csv.col_sep # => "|"
csv.first.to_a # => [["id", "1"], ["first name", "taro"...

CSV#header_convert {|field, field_info| ... } (418.0)

CSV#convert に似ていますが、ヘッダ行用のメソッドです。

CSV#convert に似ていますが、ヘッダ行用のメソッドです。

このメソッドはヘッダ行を読み込む前に呼び出さなければなりません。

@param name 変換器の名前を指定します。

//emlist[例 name を指定][ruby]{
require "csv"

csv = CSV.new("header1,header2\nrow1_1,row1_2", headers: true)
csv.header_convert(:symbol)
csv.first.headers # => [:header1, :header2]
//}

//emlist[例 ブロックを指定][...

絞り込み条件を変える

CSV#header_convert {|field| ... } (418.0)

CSV#convert に似ていますが、ヘッダ行用のメソッドです。

CSV#convert に似ていますが、ヘッダ行用のメソッドです。

このメソッドはヘッダ行を読み込む前に呼び出さなければなりません。

@param name 変換器の名前を指定します。

//emlist[例 name を指定][ruby]{
require "csv"

csv = CSV.new("header1,header2\nrow1_1,row1_2", headers: true)
csv.header_convert(:symbol)
csv.first.headers # => [:header1, :header2]
//}

//emlist[例 ブロックを指定][...

CSV#read -> [Array] | CSV::Table (412.0)

残りの行を読み込んで配列の配列を返します。 self の生成時に headers オプションに偽でない値が指定されていた場合は CSV::Table オブジェクトを返します。

残りの行を読み込んで配列の配列を返します。
self の生成時に headers オプションに偽でない値が指定されていた場合は CSV::Table オブジェクトを返します。

データソースは読み込み用にオープンされている必要があります。

//emlist[例 headers: false][ruby]{
require "csv"

csv = CSV.new(DATA.read)
csv.read
# => [["header1", "header2"], ["row1_1", "row1_2"], ["row2_1", "row2_2"]]

__END__
header1,head...

CSV#readlines -> [Array] | CSV::Table (412.0)

残りの行を読み込んで配列の配列を返します。 self の生成時に headers オプションに偽でない値が指定されていた場合は CSV::Table オブジェクトを返します。

残りの行を読み込んで配列の配列を返します。
self の生成時に headers オプションに偽でない値が指定されていた場合は CSV::Table オブジェクトを返します。

データソースは読み込み用にオープンされている必要があります。

//emlist[例 headers: false][ruby]{
require "csv"

csv = CSV.new(DATA.read)
csv.read
# => [["header1", "header2"], ["row1_1", "row1_2"], ["row2_1", "row2_2"]]

__END__
header1,head...

CSV#each {|row| ... } -> nil (397.0)

各行に対してブロックを評価します。

各行に対してブロックを評価します。

データソースは読み込み用にオープンされていなければなりません。

//emlist[例 CSV.new 時に :header => true を指定した場合][ruby]{
require "csv"

users = <<CSV
id,first name,last name,age
1,taro,tanaka,20
2,jiro,suzuki,18
3,ami,sato,19
4,yumi,adachi,21
CSV
csv = CSV.new(users, headers: true)
csv.each do |row|
p row
end

...

CSV#convert {|field, field_info| ... } (364.0)

引数 name で指定した変換器かブロックに各フィールドを渡して文字列から別 のオブジェクトへと変換します。

引数 name で指定した変換器かブロックに各フィールドを渡して文字列から別
のオブジェクトへと変換します。

引数 name を指定した場合は、組み込みの CSV::Converters を変換器
として利用するために使います。また、独自の変換器を追加することもできま
す。

ブロックパラメータを一つ受け取るブロックを与えた場合は、そのブロックは
フィールドを受け取ります。ブロックパラメータを二つ受け取るブロックを与
えた場合は、そのブロックは、フィールドと CSV::FieldInfo のインス
タンスを受け取ります。ブロックは変換後の値かフィールドそのものを返さな
ければなりません。
...

絞り込み条件を変える

CSV#convert {|field| ... } (364.0)

引数 name で指定した変換器かブロックに各フィールドを渡して文字列から別 のオブジェクトへと変換します。

引数 name で指定した変換器かブロックに各フィールドを渡して文字列から別
のオブジェクトへと変換します。

引数 name を指定した場合は、組み込みの CSV::Converters を変換器
として利用するために使います。また、独自の変換器を追加することもできま
す。

ブロックパラメータを一つ受け取るブロックを与えた場合は、そのブロックは
フィールドを受け取ります。ブロックパラメータを二つ受け取るブロックを与
えた場合は、そのブロックは、フィールドと CSV::FieldInfo のインス
タンスを受け取ります。ブロックは変換後の値かフィールドそのものを返さな
ければなりません。
...

CSV::FieldInfo#header -> String | nil (361.0)

利用可能な場合はヘッダを表す文字列を返します。

利用可能な場合はヘッダを表す文字列を返します。

//emlist[例][ruby]{
require 'csv'

csv = CSV.new("date1,date2\n2018-07-09,2018-07-10", headers: true)
csv.convert do |field,field_info|
p field_info.header
Date.parse(field)
end
p csv.first

# => "date1"
# => "date2"
# => #<CSV::Row "date1":#<Date: 2018-07-09 ((2458309j,...

CSV#header_convert(name) (118.0)

CSV#convert に似ていますが、ヘッダ行用のメソッドです。

CSV#convert に似ていますが、ヘッダ行用のメソッドです。

このメソッドはヘッダ行を読み込む前に呼び出さなければなりません。

@param name 変換器の名前を指定します。

//emlist[例 name を指定][ruby]{
require "csv"

csv = CSV.new("header1,header2\nrow1_1,row1_2", headers: true)
csv.header_convert(:symbol)
csv.first.headers # => [:header1, :header2]
//}

//emlist[例 ブロックを指定][...

CSV#convert(name) (64.0)

引数 name で指定した変換器かブロックに各フィールドを渡して文字列から別 のオブジェクトへと変換します。

引数 name で指定した変換器かブロックに各フィールドを渡して文字列から別
のオブジェクトへと変換します。

引数 name を指定した場合は、組み込みの CSV::Converters を変換器
として利用するために使います。また、独自の変換器を追加することもできま
す。

ブロックパラメータを一つ受け取るブロックを与えた場合は、そのブロックは
フィールドを受け取ります。ブロックパラメータを二つ受け取るブロックを与
えた場合は、そのブロックは、フィールドと CSV::FieldInfo のインス
タンスを受け取ります。ブロックは変換後の値かフィールドそのものを返さな
ければなりません。
...

CSV::FieldInfo#index -> Integer (58.0)

行内で何番目のフィールドかわかるゼロベースのインデックスを返します。

行内で何番目のフィールドかわかるゼロベースのインデックスを返します。

//emlist[例][ruby]{
require 'csv'

csv = CSV.new("date1,date2\n2018-07-09,2018-07-10", headers: true)
csv.convert do |field,field_info|
p field_info.index
Date.parse(field)
end
p csv.first

# => 0
# => 1
# => #<CSV::Row "date1":#<Date: 2018-07-09 ((2458309j,0s...

絞り込み条件を変える

CSV::FieldInfo#line -> Integer (58.0)

行番号を返します。

行番号を返します。

//emlist[例][ruby]{
require 'csv'

csv = CSV.new("date1,date2,date3\n2018-07-09,2018-07-10\n2018-08-09,2018-08-10", headers: true)
csv.convert do |field,field_info|
p field_info.line
Date.parse(field)
end
p csv.to_a

# => 2
# => 2
# => 3
# => 3
# => [#<CSV::Row "date1":#<Date: 2018-07...

CSV::Table#push(*rows) -> self (58.0)

複数の行を追加するためのショートカットです。

複数の行を追加するためのショートカットです。

以下と同じです。
//emlist[][ruby]{
rows.each {|row| self << row }
//}

@param rows CSV::Row のインスタンスか配列を指定します。

//emlist[例][ruby]{
require 'csv'
csv = CSV.new("a,b,c\n1,2,3", headers: true)
table = csv.read
rows = [
CSV::Row.new(table.headers, [4, 5, 6]),
[7, 8, 9]
]

table.push(...

WIN32OLE_PARAM#output? -> bool (58.0)

パラメータがクライアントからの結果を受け取るためのものかを判定します。

パラメータがクライアントからの結果を受け取るためのものかを判定します。

OLEオートメーションのパラメータは、in(クライアントからサーバへ与える。
WIN32OLE_PARAM#input?が真)、out(サーバがクライアントへ与える。
WIN32OLE_PARAM#output?が真)および、inout(クライアントからサーバ
へ与え、サーバがクライアントへ与える)の3種類の方向属性のいずれかを持ち
ます。

output?メソッドはout属性またはinout属性なら真を返します。

@return メソッドの方向属性がoutまたはinoutならば真を返します。

tobj = W...