るりまサーチ

最速Rubyリファレンスマニュアル検索!
260件ヒット [1-100件を表示] (0.047秒)
トップページ > クエリ:name[x] > クエリ:convert[x]

別のキーワード

  1. _builtin name
  2. resolv each_name
  3. openssl name
  4. net/imap name
  5. win32ole name

検索結果

<< 1 2 3 > >>

CSV#convert(name) (18256.0)

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

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

引数 name を指定した場合は、組み込みの CSV::Converters を変換器
として利用するために使います。また、独自の...
...ドそのものを返さな
ければなりません。

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

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

csv = CSV.new("date1,date2\n2018-07-09,2018-07-10")
csv.convert(:date)
csv.read # => 2018-07-09 ((2458309j,0s,0n),+0s,229916...
...s,2299161j)>
//}

//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
p field_info
Date.parse(field)
end
p csv.first

# => "2018-07-09"
# => <struct CSV::FieldInfo index=0, line=2...

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

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

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

引数 name を指定した場合は、組み込みの CSV::Converters を変換器
として利用するために使います。また、独自の...
...ドそのものを返さな
ければなりません。

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

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

csv = CSV.new("date1,date2\n2018-07-09,2018-07-10")
csv.convert(:date)
csv.read # => 2018-07-09 ((2458309j,0s,0n),+0s,229916...
...s,2299161j)>
//}

//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
p field_info
Date.parse(field)
end
p csv.first

# => "2018-07-09"
# => <struct CSV::FieldInfo index=0, line=2...

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

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

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

引数 name を指定した場合は、組み込みの CSV::Converters を変換器
として利用するために使います。また、独自の...
...ドそのものを返さな
ければなりません。

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

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

csv = CSV.new("date1,date2\n2018-07-09,2018-07-10")
csv.convert(:date)
csv.read # => 2018-07-09 ((2458309j,0s,0n),+0s,229916...
...s,2299161j)>
//}

//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
p field_info
Date.parse(field)
end
p csv.first

# => "2018-07-09"
# => <struct CSV::FieldInfo index=0, line=2...

CSV#header_convert(name) (6250.0)

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

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

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

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

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

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

//emlist[例 ブロックを指定][ruby]{
require "csv"

csv = CSV.new("header1,header2\nrow1_1,row1_2", headers: true)
csv.header_convert do |field|
field.to_sym
end
csv.first.header...
...s # => [:header1, :header2]
//}

@see CSV#header_converters, CSV#convert...

VALUE rb_check_convert_type(VALUE val, int type, const char *tname, const char *method) (6200.0)

val.method を実行してクラス tname のインスタンスを返します。 val がメソッド method を持たなければ nil を返します。

...val.method を実行してクラス tname のインスタンスを返します。
val がメソッド method を持たなければ nil を返します。

type は、T_ARRAY, T_STRING などの構造体を表す ID です。
method の結果の型が type でなければ例外 TypeError が発生...

絞り込み条件を変える

VALUE rb_convert_type(VALUE val, int type, const char *tname, const char *method) (6200.0)

オブジェクト val をクラス type のインスタンスに変換します。 変換には、val.method の戻り値が使われます。

オブジェクト val をクラス type のインスタンスに変換します。
変換には、val.method の戻り値が使われます。

val がもともと type クラスのインスタンスなら val を
そのまま返します。

static VALUE convert_type(VALUE val, const char *tname, const char *method, int raise) (6200.0)

Kernel#convertible_int(type, headers = nil, opts = nil) (6196.0)

Returns the convertible integer type of the given +type+. You may optionally specify additional +headers+ to search in for the +type+. _Convertible_ means actually same type, or typedefed from same type. If the +type+ is a integer type and _convertible_ type is found, following macros are passed as preprocessor constants to the compiler using the +type+ name, in uppercase. * 'TYPEOF_', followed by the +type+ name, followed by '=X' where 'X' is the found _convertible_ type name. * 'TYP2NUM' and 'NUM2TYP, where 'TYP' is the +type+ name in uppercase with replacing '_t' suffix with 'T', followed by '=X' where 'X' is the macro name to convert +type+ to +Integer+ object, and vice versa. For example, if foobar_t is defined as unsigned long, then convertible_int("foobar_t") would return "unsigned long", and define macros: #define TYPEOF_FOOBAR_T unsigned long #define FOOBART2NUM ULONG2NUM #define NUM2FOOBART NUM2ULONG

...Returns the convertible integer type of the given +type+. You may
optionally specify additional +headers+ to search in for the +type+.
_Convertible_ means actually same type, or typedefed from same type.

If the +type+ is a integer type and _convertible_ type is found,
following macros are p...
...ype+ name, in uppercase.

* 'TYPEOF_', followed by the +type+ name, followed by '=X' where 'X'
is the found _convertible_ type name. * 'TYP2NUM' and 'NUM2TYP,
where 'TYP' is the +type+ name in uppercase with replacing '_t'
suffix with 'T', followed by '=X' where 'X' is the macro name to...
...convert +type+ to +Integer+ object, and vice versa.

For example, if foobar_t is defined as unsigned long, then
convert
ible_int("foobar_t") would return "unsigned long", and define
macros:

#define TYPEOF_FOOBAR_T unsigned long
#define FOOBART2NUM ULONG2NUM
#define NUM2FOOBART NUM2U...

Kernel#convertible_int(type, headers = nil, opts = nil) { ... } (6196.0)

Returns the convertible integer type of the given +type+. You may optionally specify additional +headers+ to search in for the +type+. _Convertible_ means actually same type, or typedefed from same type. If the +type+ is a integer type and _convertible_ type is found, following macros are passed as preprocessor constants to the compiler using the +type+ name, in uppercase. * 'TYPEOF_', followed by the +type+ name, followed by '=X' where 'X' is the found _convertible_ type name. * 'TYP2NUM' and 'NUM2TYP, where 'TYP' is the +type+ name in uppercase with replacing '_t' suffix with 'T', followed by '=X' where 'X' is the macro name to convert +type+ to +Integer+ object, and vice versa. For example, if foobar_t is defined as unsigned long, then convertible_int("foobar_t") would return "unsigned long", and define macros: #define TYPEOF_FOOBAR_T unsigned long #define FOOBART2NUM ULONG2NUM #define NUM2FOOBART NUM2ULONG

...Returns the convertible integer type of the given +type+. You may
optionally specify additional +headers+ to search in for the +type+.
_Convertible_ means actually same type, or typedefed from same type.

If the +type+ is a integer type and _convertible_ type is found,
following macros are p...
...ype+ name, in uppercase.

* 'TYPEOF_', followed by the +type+ name, followed by '=X' where 'X'
is the found _convertible_ type name. * 'TYP2NUM' and 'NUM2TYP,
where 'TYP' is the +type+ name in uppercase with replacing '_t'
suffix with 'T', followed by '=X' where 'X' is the macro name to...
...convert +type+ to +Integer+ object, and vice versa.

For example, if foobar_t is defined as unsigned long, then
convert
ible_int("foobar_t") would return "unsigned long", and define
macros:

#define TYPEOF_FOOBAR_T unsigned long
#define FOOBART2NUM ULONG2NUM
#define NUM2FOOBART NUM2U...

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

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

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

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

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

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

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

//emlist[例 ブロックを指定][ruby]{
require "csv"

csv = CSV.new("header1,header2\nrow1_1,row1_2", headers: true)
csv.header_convert do |field|
field.to_sym
end
csv.first.header...
...s # => [:header1, :header2]
//}

@see CSV#header_converters, CSV#convert...

絞り込み条件を変える

<< 1 2 3 > >>