るりまサーチ

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

別のキーワード

  1. csv convert
  2. csv header_convert
  3. _builtin try_convert
  4. _builtin primitive_convert
  5. converter primitive_convert

ライブラリ

モジュール

検索結果

<< < 1 2 3 4 5 ... > >>

Array.try_convert(obj) -> Array | nil (6125.0)

to_ary メソッドを用いて obj を配列に変換しようとします。

...引数が配列であるかどうかを調べるために使えます。

//emlist[例][ruby]{
Array.try_convert([1]) # => [1]
Array.try_convert("1") # => nil

if tmp = Array.try_convert(arg)
# the argument is an array
elsif tmp = String.try_convert(arg)
# the argument is a string
end
//}...

Integer.try_convert(obj) -> Integer | nil (6119.0)

obj を Integer に変換しようと試みます。変換には Object#to_int メソッドが使われます。

...param obj 変換する任意のオブジェクト
@return Integer または nil
@raise TypeError to_int が Integer を返さなかった場合に発生します。

//emlist[例][ruby]{
Integer.try_convert(1) # => 1
Integer.try_convert(1.25) # => 1
Integer.try_convert([]) # => nil
//}...

Kernel#convertible_int(type, headers = nil, opts = nil) (6116.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...
...+ 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 NUM2ULONG...

Kernel#convertible_int(type, headers = nil, opts = nil) { ... } (6116.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...
...+ 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 NUM2ULONG...

Hash.try_convert(obj) -> Hash | nil (6113.0)

to_hash メソッドを用いて obj をハッシュに変換しようとします。

...しようとします。

何らかの理由で変換できないときには nil を返します。
このメソッドは引数がハッシュであるかどうかを調べるために使えます。

//emlist[][ruby]{
Hash.try_convert({1=>2}) # => {1=>2}
Hash.try_convert("1=>2") # => nil
//}...

絞り込み条件を変える

IO.try_convert(obj) -> IO | nil (6113.0)

obj を to_io メソッドによって IO オブジェクトに変換します。 変換できなかった場合は nil を返します。

...obj を to_io メソッドによって IO オブジェクトに変換します。
変換できなかった場合は nil を返します。

IO.try_convert(STDOUT) # => STDOUT
IO.try_convert("STDOUT") # => nil...

Regexp.try_convert(obj) -> Regexp | nil (6113.0)

obj を to_regexp メソッドで Regexp オブジェクトに変換しようと 試みます。

...obj を to_regexp メソッドで Regexp オブジェクトに変換しようと
試みます。

変換に成功した場合はそれを返し、失敗時には nil を返します。

//emlist[例][ruby]{
Regexp.try_convert(/re/) # => /re/
Regexp.try_convert("re") # => nil
//}...

String.try_convert(obj) -> String | nil (6113.0)

obj を String に変換しようと試みます。変換には Object#to_str メソッ ドが使われます。変換後の文字列を返すか、何らかの理由により変換できなかっ た場合は nil が返されます。

...、何らかの理由により変換できなかっ
た場合は nil が返されます。

@param obj 変換する任意のオブジェクト
@return 変換後の文字列または nil

//emlist[例][ruby]{
String.try_convert("str") # => "str"
String.try_convert(/re/) # => nil
//}...

CSV#unconverted_fields? -> bool (6106.0)

パースした結果が unconverted_fields というメソッドを持つ場合に真を返します。 そうでない場合は、偽を返します。

...パースした結果が unconverted_fields というメソッドを持つ場合に真を返します。
そうでない場合は、偽を返します。


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

csv = CSV.new("date1,date2\n2018-07-09,2018-07-10")
csv.unconverted_fields? # => nil
csv = CSV.new("date1,d...
...ate2\n2018-07-09,2018-07-10", unconverted_fields: false)
csv.unconverted_fields? # => false
csv = CSV.new("date1,date2\n2018-07-09,2018-07-10", headers: true, unconverted_fields: true)
csv.unconverted_fields? # => true
csv.convert(:date)
row = csv.readline
row.fields # => [#<Date: 2018-...
...07-09 ((2458309j,0s,0n),+0s,2299161j)>, #<Date: 2018-07-10 ((2458310j,0s,0n),+0s,2299161j)>]
row.unconverted_fields # => ["2018-07-09", "2018-07-10"]
//}

@see CSV.new...

CSV::Converters -> Hash (6106.0)

このハッシュは名前でアクセスできる組み込みの変換器を保持しています。

...このハッシュは名前でアクセスできる組み込みの変換器を保持しています。

CSV#convert で使用する変換器として使用できます。
また CSV.new のオプションとして使用することもできます。

: :integer
Kernel.#Integer を使用してフ...

絞り込み条件を変える

<< < 1 2 3 4 5 ... > >>