種類
- インスタンスメソッド (121)
- 文書 (73)
- 関数 (33)
- ライブラリ (22)
- クラス (11)
ライブラリ
- ビルトイン (11)
- csv (66)
- mkmf (22)
-
rdoc
/ markup (33)
クラス
- CSV (66)
-
RDoc
:: Markup (33)
モジュール
- Kernel (22)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) -
NEWS for Ruby 2
. 5 . 0 (7) - UndefinedConversionError (11)
-
add
_ html (11) -
add
_ special (11) -
add
_ word _ pair (11) -
convert
_ type (11) -
convertible
_ int (22) -
header
_ convert (33) -
rb
_ check _ convert _ type (11) -
rb
_ convert _ type (11) - rdoc (11)
- rss (11)
-
ruby 1
. 6 feature (11) -
ruby 1
. 8 . 2 feature (11) -
ruby 1
. 8 . 3 feature (11) -
ruby 1
. 9 feature (11) - 多言語化 (11)
検索結果
先頭5件
-
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
convertible_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
convertible_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...