るりまサーチ (Ruby 2.3.0)

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

別のキーワード

  1. matrix l
  2. kernel $-l
  3. _builtin $-l
  4. lupdecomposition l
  5. l matrix

検索結果

Rational#convert(*arg) -> Rational (63604.0)

引数を有理数(Rational)に変換した結果を返します。

引数を有理数(Rational)に変換した結果を返します。

@param arg 変換対象のオブジェクトです。

Kernel.#Rational の本体です。

@see Kernel.#Rational

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

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

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

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

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

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

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

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

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

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

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

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

絞り込み条件を変える

CSV#unconverted_fields? -> bool (36619.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,date2\n2018-07-09,2018-07-10", unconverted_fields: false)
csv.unconverted_fields? # => fals...

Encoding::Converter#primitive_convert(source_buffer, destination_buffer) -> Symbol (27649.0)

エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。

エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。

可搬性を確保しつつ、不正なバイトや変換先で未定義な文字の扱いを細かに指定したいときは、Encoding::Converter#primitive_convert が唯一の方法になります。

@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_bytesize 変換先バッファの容量
@...

Encoding::Converter#primitive_convert(source_buffer, destination_buffer, destination_byteoffset) -> Symbol (27649.0)

エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。

エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。

可搬性を確保しつつ、不正なバイトや変換先で未定義な文字の扱いを細かに指定したいときは、Encoding::Converter#primitive_convert が唯一の方法になります。

@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_bytesize 変換先バッファの容量
@...

Encoding::Converter#primitive_convert(source_buffer, destination_buffer, destination_byteoffset, destination_bytesize) -> Symbol (27649.0)

エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。

エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。

可搬性を確保しつつ、不正なバイトや変換先で未定義な文字の扱いを細かに指定したいときは、Encoding::Converter#primitive_convert が唯一の方法になります。

@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_bytesize 変換先バッファの容量
@...

Encoding::Converter#primitive_convert(source_buffer, destination_buffer, destination_byteoffset, destination_bytesize, options) -> Symbol (27649.0)

エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。

エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。

可搬性を確保しつつ、不正なバイトや変換先で未定義な文字の扱いを細かに指定したいときは、Encoding::Converter#primitive_convert が唯一の方法になります。

@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_bytesize 変換先バッファの容量
@...

絞り込み条件を変える

Encoding::Converter#last_error -> Exception | nil (27337.0)

直前に変換器で発生した例外に相当する例外オブジェクトを返します。 直前の変換で例外が発生していない場合は nil を返します。

直前に変換器で発生した例外に相当する例外オブジェクトを返します。
直前の変換で例外が発生していない場合は nil を返します。

//emlist[][ruby]{
ec = Encoding::Converter.new("utf-8", "iso-8859-1")
p ec.primitive_convert(src="\xf1abcd", dst="") #=> :invalid_byte_sequence
p ec.last_error #=> #<Encoding::InvalidByteSequenceError: "\xF1" followed by "a"...

Encoding::Converter#replacement=(string) (27319.0)

置換文字を設定します。

置換文字を設定します。

@param string 変換器に設定する置換文字

//emlist[][ruby]{
ec = Encoding::Converter.new("utf-8", "us-ascii", :undef => :replace)
ec.replacement = "<undef>"
p ec.convert("a \u3042 b") #=> "a <undef> b"
//}

Encoding::Converter#replacement -> String (27301.0)

変換器に設定されている置換文字を返します。

変換器に設定されている置換文字を返します。

@return 変換器に設定されている置換文字

//emlist[][ruby]{
ec = Encoding::Converter.new("euc-jp", "us-ascii")
p ec.replacement #=> "?"

ec = Encoding::Converter.new("euc-jp", "utf-8")
p ec.replacement #=> "\uFFFD"
//}

CSV#header_convert {|field, field_info| ... } (19012.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[例 ブロックを指定][...

VALUE rb_check_convert_type(VALUE val, int type, const char *tname, const char *method) (18901.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) (18901.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) (18901.0)

CSV#header_convert {|field| ... } (18712.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[例 ブロックを指定][...

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

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

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

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

//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 ...

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

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

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 (18640.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 (18640.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 (18640.0)

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

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

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

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

Kernel.#Float(arg) -> Float (18637.0)

引数を浮動小数点数(Float)に変換した結果を返します。

引数を浮動小数点数(Float)に変換した結果を返します。

引数が数値の場合は素直に変換し、文字列の場合
は整数や浮動小数点数と見なせるもののみ変換します。

メソッド Float は文字列に対し String#to_f よりも厳密な変換を行います。

@param arg 変換対象のオブジェクトです。
@raise ArgumentError 整数や浮動小数点数と見なせない文字列を引数に指定した場合に発生します。
@raise TypeError nil またはメソッド to_f を持たないオブジェクトを引数に指定したか、
to_f が浮動小数点数を返さ...

Encoding::InvalidByteSequenceError#incomplete_input? -> bool (18337.0)

エラー発生時に入力文字列が不足している場合に真を返します。

エラー発生時に入力文字列が不足している場合に真を返します。

つまり、マルチバイト文字列の途中で文字列が終わっている場合に
真を返します。これは後続の入力を追加することでエラーが
解消する可能性があることを意味します。

//emlist[例][ruby]{
ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1")

begin
ec.convert("abc\xA1z")
rescue Encoding::InvalidByteSequenceError
p $!
#=> #<Encoding::InvalidByteSequenc...

絞り込み条件を変える

RDoc::Markup#get_line_types -> [Symbol] (18337.0)

変換する文字列の各行のタイプを Symbol の配列で返します。

変換する文字列の各行のタイプを Symbol の配列で返します。

rdoc ライブラリのデバッグ用途に使用します。
SM::SimpleMarkup#convert の後に実行します。

@see SM::SimpleMarkup#convert

CSV::FieldInfo#line -> Integer (18319.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...

RDoc::Markup#add_html(tag, name) -> () (18319.0)

tag で指定したタグをフォーマットの対象にします。

tag で指定したタグをフォーマットの対象にします。

@param tag 追加するタグ名を文字列で指定します。大文字、小文字のど
ちらを指定しても同一のものとして扱われます。

@param name SM::ToHtml などのフォーマッタに識別させる時の名前を
Symbol で指定します。

例:

require 'rdoc/markup/simple_markup'
require 'rdoc/markup/simple_markup/to_html'
m = SM::SimpleMarkup.new
m.add_ht...

RDoc::Markup#add_special(pattern, name) -> () (18319.0)

pattern で指定した正規表現にマッチする文字列をフォーマットの対象にしま す。

pattern で指定した正規表現にマッチする文字列をフォーマットの対象にしま
す。

例えば WikiWord のような、SM::SimpleMarkup#add_word_pair、
SM::SimpleMarkup#add_html でフォーマットできないものに対して使用
します。

@param pattern 正規表現を指定します。

@param name SM::ToHtml などのフォーマッタに識別させる時の名前を
Symbol で指定します。

例:

require 'rdoc/markup/simple_markup'
require '...

rdoc/markup/to_html (18019.0)

RDoc 形式のドキュメントを HTML に整形するためのサブライブラリです。

RDoc 形式のドキュメントを HTML に整形するためのサブライブラリです。

require 'rdoc/markup/to_html'

h = RDoc::Markup::ToHtml.new
puts h.convert(input_string)

変換した結果は文字列で取得できます。

絞り込み条件を変える

Encoding::Converter#insert_output(string) -> nil (9373.0)

変換器内のバッファに文字列を挿入します。 バッファに保持された文字列は、次の変換時の変換結果と一緒に返されます。

変換器内のバッファに文字列を挿入します。
バッファに保持された文字列は、次の変換時の変換結果と一緒に返されます。

変換先がステートフルなエンコーディングであった場合、
挿入された文字列は状態に基づいて変換され、状態を更新します。

このメソッドは変換に際してエラーが発生した際にのみ利用されるべきです。

@param string 挿入する文字列

//emlist[][ruby]{
ec = Encoding::Converter.new("utf-8", "iso-8859-1")
src = "HIRAGANA LETTER A is \u{3042}."
dst = ""
p ec....

CSV::FieldInfo#header -> String | nil (9319.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,...

Encoding::Converter.asciicompat_encoding(encoding) -> Encoding | nil (9301.0)

同じ文字集合を持つ ASCII 互換エンコーディングを返します。

同じ文字集合を持つ ASCII 互換エンコーディングを返します。

@param string エンコーディング名
@param encoding エンコーディングオブジェクト
@return ASCII 互換エンコーディングのオブジェクトか nil

引数とエンコーディングと同じ文字集合を持つ ASCII 互換エンコーディングを返します。引数と戻り値、2 つのエンコーディング間では変換しても未定義文字の例外は発生しません。
引数が ASCII 互換エンコーディングである場合や、エンコーディングでない場合は nil を返します。

//emlist[][ruby]{
Encoding::Con...

Encoding::Converter.asciicompat_encoding(string) -> Encoding | nil (9301.0)

同じ文字集合を持つ ASCII 互換エンコーディングを返します。

同じ文字集合を持つ ASCII 互換エンコーディングを返します。

@param string エンコーディング名
@param encoding エンコーディングオブジェクト
@return ASCII 互換エンコーディングのオブジェクトか nil

引数とエンコーディングと同じ文字集合を持つ ASCII 互換エンコーディングを返します。引数と戻り値、2 つのエンコーディング間では変換しても未定義文字の例外は発生しません。
引数が ASCII 互換エンコーディングである場合や、エンコーディングでない場合は nil を返します。

//emlist[][ruby]{
Encoding::Con...

Kernel.#Integer(arg, base = 0) -> Integer (9037.0)

引数を整数(Fixnum,Bignum)に変換した結果を返します。

引数を整数(Fixnum,Bignum)に変換した結果を返します。

引数が数値の場合は直接変換し(小数点以下切り落とし)、
文字列の場合は、進数を表す接頭辞を含む整数表現とみなせる文字列のみ
変換します。

数値と文字列以外のオブジェクトに対しては arg.to_int, arg.to_i を
この順に使用して変換します。

@param arg 変換対象のオブジェクトです。

@param base 基数として0か2から36の整数を指定します(引数argに文字列を指
定した場合のみ)。省略するか0を指定した場合はプリフィクスか
ら基数を判断...

絞り込み条件を変える

CSV::FieldInfo#index -> Integer (9019.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...

Encoding::InvalidByteSequenceError#error_bytes -> String (9019.0)

エラー発生時に捨てられたバイト列を返します。

エラー発生時に捨てられたバイト列を返します。


//emlist[例][ruby]{
ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1")
begin
ec.convert("abc\xA1\xFFdef")
rescue Encoding::InvalidByteSequenceError
p $!
#=> #<Encoding::InvalidByteSequenceError: "\xA1" followed by "\xFF" on EUC-JP>
puts $!.error_bytes.dump ...

Kernel.#putc(ch) -> object (9019.0)

文字 ch を 標準出力 $stdout に出力します。

文字 ch を 標準出力 $stdout に出力します。

ch が数値なら 0 〜 255 の範囲の対応する文字を出力します。
ch が文字列なら、その先頭1文字を出力します。
どちらでもない場合は、ch.to_int で整数に変換を試みます。

@param ch 出力する文字です。数または文字列で指定します。
@return ch を返します
@raise RangeError Bignum を引数にした場合に発生します。
@raise IOError 標準出力が書き込み用にオープンされていなければ発生します。
@raise Errno::EXXX 出力に失敗した場合に発生します。
@...

Regexp#=~(string) -> Integer | nil (319.0)

文字列 string との正規表現マッチを行います。マッチした場合、 マッチした位置のインデックスを返します(先頭は0)。マッチしなかった 場合、あるいは string が nil の場合には nil を返 します。

文字列 string との正規表現マッチを行います。マッチした場合、
マッチした位置のインデックスを返します(先頭は0)。マッチしなかった
場合、あるいは string が nil の場合には nil を返
します。

//emlist[例][ruby]{
p /foo/ =~ "foo" # => 0
p /foo/ =~ "afoo" # => 1
p /foo/ =~ "bar" # => nil
//}

組み込み変数 $~ もしくは Regexp.last_match にマッチに関する情報 MatchData が設定されます。

文字列のかわりにSymbolをマッチさせることが...

ruby 1.8.2 feature (55.0)

ruby 1.8.2 feature ruby 1.8.2 での ruby 1.8.1 からの変更点です。

ruby 1.8.2 feature
ruby 1.8.2 での ruby 1.8.1 からの変更点です。

掲載方針

*バグ修正の影響も含めて動作が変わるものを収録する。
*単にバグを直しただけのものは収録しない。
*ライブラリへの単なる定数の追加は収録しない。

以下は各変更点に付けるべきタグです。

*カテゴリ
* [ruby]: ruby インタプリタの変更
* [api]: 拡張ライブラリ API
* [lib]: ライブラリ
*レベル
* [bug]: バグ修正
* [new]: 追加されたクラス/メソッドなど
* [compat]: 変更されたクラス/...

絞り込み条件を変える