るりまサーチ (Ruby 2.1.0)

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

別のキーワード

  1. kernel system
  2. kernel exec
  3. kernel spawn
  4. kernel open
  5. kernel caller

ライブラリ

モジュール

キーワード

検索結果

Kernel#try_constant(const, headers = nil, opt = "") -> Integer | nil (63358.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 (63358.0)

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

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

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

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

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

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

Kernel#check_sizeof(type, headers = nil) -> Integer | nil (63310.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 (63310.0)

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

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

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

例えば、

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

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

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

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

Kernel#convertible_int(type, headers = nil, opts = nil) (63148.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) { ... } (63148.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#check_signedness(type, headers = nil, opts = nil) -> "signed" | "unsigned" | nil (63100.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 (63100.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...

String#hex -> Integer (415.0)

文字列に 16 進数で数値が表現されていると解釈して整数に変換します。 接頭辞 "0x", "0X" とアンダースコアは無視されます。 文字列が [_0-9a-fA-F] 以外の文字を含むときはその文字以降を無視します。

文字列に 16 進数で数値が表現されていると解釈して整数に変換します。
接頭辞 "0x", "0X" とアンダースコアは無視されます。
文字列が [_0-9a-fA-F] 以外の文字を含むときはその文字以降を無視します。

self が空文字列のときは 0 を返します。

//emlist[例][ruby]{
p "10".hex # => 16
p "ff".hex # => 255
p "0x10".hex # => 16
p "-0x10".hex # => -16

p "xyz".hex # => 0
p "10z".hex # => 16
p "1_0".h...

String#oct -> Integer (415.0)

文字列を 8 進文字列であると解釈して、整数に変換します。

文字列を 8 進文字列であると解釈して、整数に変換します。

//emlist[例][ruby]{
p "10".oct # => 8
p "010".oct # => 8
p "8".oct # => 0
//}

oct は文字列の接頭辞 ("0", "0b", "0B", "0x", "0X") に応じて
8 進以外の変換も行います。

//emlist[例][ruby]{
p "0b10".oct # => 2
p "10".oct # => 8
p "010".oct # => 8
p "0x10".oct # => 16
//}

整数とみなせない文字があれば...

絞り込み条件を変える

String#to_i(base = 10) -> Integer (415.0)

文字列を 10 進数表現された整数であると解釈して、整数に変換します。

文字列を 10 進数表現された整数であると解釈して、整数に変換します。

//emlist[例][ruby]{
p " 10".to_i # => 10
p "+10".to_i # => 10
p "-10".to_i # => -10

p "010".to_i # => 10
p "-010".to_i # => -10
//}

整数とみなせない文字があればそこまでを変換対象とします。
変換対象が空文字列であれば 0 を返します。

//emlist[例][ruby]{
p "0x11".to_i # => 0
p "".to_i # =>...

Object#to_int -> Integer (409.0)

オブジェクトの Integer への暗黙の変換が必要なときに内部で呼ばれます。 デフォルトでは定義されていません。

オブジェクトの Integer への暗黙の変換が必要なときに内部で呼ばれます。
デフォルトでは定義されていません。

説明のためここに記載してありますが、
このメソッドは実際には Object クラスには定義されていません。
必要に応じてサブクラスで定義すべきものです。

このメソッドを定義する条件は、
* 整数が使われるすべての場面で代置可能であるような、
* 整数そのものとみなせるようなもの
という厳しいものになっています。

//emlist[][ruby]{
class Foo
def to_int
1
end
end

ary = [:a, :b, :c]
p(...

Shell#[](command, file1, file2 = nil) -> bool | Time | Integer | nil (394.0)

Kernel.#test や FileTest のメソッドに処理を委譲します。

Kernel.#test や FileTest のメソッドに処理を委譲します。

@param command 数値、またはサイズが 1 の文字列の場合は Kernel.#test に処理委譲します。
2 文字以上の文字列の場合は FileTest のメソッドとして実行します。

@param file1 文字列でファイルへのパスを指定します。

@param file2 文字列でファイルへのパスを指定します。

require 'shell'
Shell.verbose = false
sh = Shell.new
begin
sh.m...

Shell#test(command, file1, file2 = nil) -> bool | Time | Integer | nil (394.0)

Kernel.#test や FileTest のメソッドに処理を委譲します。

Kernel.#test や FileTest のメソッドに処理を委譲します。

@param command 数値、またはサイズが 1 の文字列の場合は Kernel.#test に処理委譲します。
2 文字以上の文字列の場合は FileTest のメソッドとして実行します。

@param file1 文字列でファイルへのパスを指定します。

@param file2 文字列でファイルへのパスを指定します。

require 'shell'
Shell.verbose = false
sh = Shell.new
begin
sh.m...

Shell::CommandProcessor#[](command, file1, file2 = nil) -> bool | Time | Integer | nil (394.0)

Kernel.#test や FileTest のメソッドに処理を委譲します。

Kernel.#test や FileTest のメソッドに処理を委譲します。

@param command 数値、またはサイズが 1 の文字列の場合は Kernel.#test に処理委譲します。
2 文字以上の文字列の場合は FileTest のメソッドとして実行します。

@param file1 文字列でファイルへのパスを指定します。

@param file2 文字列でファイルへのパスを指定します。

require 'shell'
Shell.verbose = false
sh = Shell.new
begin
sh.m...

絞り込み条件を変える

Shell::CommandProcessor#test(command, file1, file2 = nil) -> bool | Time | Integer | nil (394.0)

Kernel.#test や FileTest のメソッドに処理を委譲します。

Kernel.#test や FileTest のメソッドに処理を委譲します。

@param command 数値、またはサイズが 1 の文字列の場合は Kernel.#test に処理委譲します。
2 文字以上の文字列の場合は FileTest のメソッドとして実行します。

@param file1 文字列でファイルへのパスを指定します。

@param file2 文字列でファイルへのパスを指定します。

require 'shell'
Shell.verbose = false
sh = Shell.new
begin
sh.m...

Shell::Filter#[](command, file1, file2 = nil) -> bool | Time | Integer | nil (394.0)

Kernel.#test や FileTest のメソッドに処理を委譲します。

Kernel.#test や FileTest のメソッドに処理を委譲します。

@param command 数値、またはサイズが 1 の文字列の場合は Kernel.#test に処理委譲します。
2 文字以上の文字列の場合は FileTest のメソッドとして実行します。

@param file1 文字列でファイルへのパスを指定します。

@param file2 文字列でファイルへのパスを指定します。

require 'shell'
Shell.verbose = false
sh = Shell.new
begin
sh.m...

Shell::Filter#test(command, file1, file2 = nil) -> bool | Time | Integer | nil (394.0)

Kernel.#test や FileTest のメソッドに処理を委譲します。

Kernel.#test や FileTest のメソッドに処理を委譲します。

@param command 数値、またはサイズが 1 の文字列の場合は Kernel.#test に処理委譲します。
2 文字以上の文字列の場合は FileTest のメソッドとして実行します。

@param file1 文字列でファイルへのパスを指定します。

@param file2 文字列でファイルへのパスを指定します。

require 'shell'
Shell.verbose = false
sh = Shell.new
begin
sh.m...

Random#rand(max) -> Integer | Float (382.0)

一様な擬似乱数を発生させます。

一様な擬似乱数を発生させます。

最初の形式では 0.0 以上 1.0 未満の実数を返します。

二番目の形式では 0 以上 max 未満の数を返します。
max が正の整数なら整数を、正の実数なら実数を返します。
0 や負の数を指定することは出来ません。

三番目の形式では range で指定された範囲の値を返します。
range の始端と終端が共に整数の場合は整数を、少なくとも片方が実数の場合は実数を返します。
rangeが終端を含まない(つまり ... で生成した場合)には終端の値は乱数の範囲から除かれます。
range.end - range.begin が整数を返す場合は rang...

Random#rand(range) -> Integer | Float (382.0)

一様な擬似乱数を発生させます。

一様な擬似乱数を発生させます。

最初の形式では 0.0 以上 1.0 未満の実数を返します。

二番目の形式では 0 以上 max 未満の数を返します。
max が正の整数なら整数を、正の実数なら実数を返します。
0 や負の数を指定することは出来ません。

三番目の形式では range で指定された範囲の値を返します。
range の始端と終端が共に整数の場合は整数を、少なくとも片方が実数の場合は実数を返します。
rangeが終端を含まない(つまり ... で生成した場合)には終端の値は乱数の範囲から除かれます。
range.end - range.begin が整数を返す場合は rang...

絞り込み条件を変える

SystemExit#status -> Integer (325.0)

例外オブジェクトに保存された終了ステータスを返します。

例外オブジェクトに保存された終了ステータスを返します。

終了ステータスは Kernel.#exit や SystemExit.new などで設定されます。

例:

begin
exit 1
rescue SystemExit => err
p err.status # => 1
end

begin
raise SystemExit.new(1, "dummy exit")
rescue SystemExit => err
p err.status # => 1
end

String#to_f -> Float (112.0)

文字列を 10 進数表現と解釈して、浮動小数点数 Float に変換します。

文字列を 10 進数表現と解釈して、浮動小数点数 Float に変換します。

浮動小数点数とみなせなくなるところまでを変換対象とします。
途中に変換できないような文字列がある場合、それより先の文字列は無視されます。

//emlist[][ruby]{
p "-10".to_f # => -10.0
p "10e2".to_f # => 1000.0
p "1e-2".to_f # => 0.01
p ".1".to_f # => 0.1

p "1_0_0".to_f # => 100.0 # 数値リテラルと同じように区切りに _ を使える
p " \n10".to_f ...

String#%(args) -> String (94.0)

printf と同じ規則に従って args をフォーマットします。

printf と同じ規則に従って args をフォーマットします。

args が配列であれば Kernel.#sprintf(self, *args) と同じです。
それ以外の場合は Kernel.#sprintf(self, args) と同じです。

@param args フォーマットする値、もしくはその配列
@return フォーマットされた文字列

//emlist[例][ruby]{
p "i = %d" % 10 # => "i = 10"
p "i = %x" % 10 # => "i = a"
p "i = %o" % 10...

UnboundMethod#owner -> Class | Module (94.0)

このメソッドが定義されている class か module を返します。

このメソッドが定義されている class か module を返します。

//emlist[例][ruby]{
Integer.instance_method(:to_s).owner # => Integer
Integer.instance_method(:to_c).owner # => Numeric
Integer.instance_method(:hash).owner # => Kernel
//}

Random#rand -> Float (82.0)

一様な擬似乱数を発生させます。

一様な擬似乱数を発生させます。

最初の形式では 0.0 以上 1.0 未満の実数を返します。

二番目の形式では 0 以上 max 未満の数を返します。
max が正の整数なら整数を、正の実数なら実数を返します。
0 や負の数を指定することは出来ません。

三番目の形式では range で指定された範囲の値を返します。
range の始端と終端が共に整数の場合は整数を、少なくとも片方が実数の場合は実数を返します。
rangeが終端を含まない(つまり ... で生成した場合)には終端の値は乱数の範囲から除かれます。
range.end - range.begin が整数を返す場合は rang...

絞り込み条件を変える

String#scanf(format) -> Array (58.0)

ブロックを指定しない場合、見つかった文字列を format に従って変 換し、そのオブジェクトの配列を返します。 format で指定した文字列が見つからない場合は空の配列を 生成して返します。

ブロックを指定しない場合、見つかった文字列を format に従って変
換し、そのオブジェクトの配列を返します。
format で指定した文字列が見つからない場合は空の配列を
生成して返します。

require 'scanf'
str = "123 abc 456 def 789 ghi"
p str.scanf("%d%s") #=> [123, "abc"]

ブロックを指定した場合は scanf を継続して実行し、順次
見つかった文字列を変換したオブジェクトの配列を引数に、ブロックを
実行します。このとき、ブロックの実行結果を要素とする配列を返します。

requir...

String#scanf(format) {|*ary| ...} -> Array (58.0)

ブロックを指定しない場合、見つかった文字列を format に従って変 換し、そのオブジェクトの配列を返します。 format で指定した文字列が見つからない場合は空の配列を 生成して返します。

ブロックを指定しない場合、見つかった文字列を format に従って変
換し、そのオブジェクトの配列を返します。
format で指定した文字列が見つからない場合は空の配列を
生成して返します。

require 'scanf'
str = "123 abc 456 def 789 ghi"
p str.scanf("%d%s") #=> [123, "abc"]

ブロックを指定した場合は scanf を継続して実行し、順次
見つかった文字列を変換したオブジェクトの配列を引数に、ブロックを
実行します。このとき、ブロックの実行結果を要素とする配列を返します。

requir...

Thread#add_trace_func(pr) -> Proc (58.0)

スレッドにトレース用ハンドラを追加します。

スレッドにトレース用ハンドラを追加します。

追加したハンドラを返します。

@param pr トレースハンドラ(Proc オブジェクト)

//emlist[例][ruby]{
th = Thread.new do
class Trace
end
43.to_s
end
th.add_trace_func lambda {|*arg| p arg }
th.join

# => ["line", "example.rb", 4, nil, #<Binding:0x00007f98e107d0d8>, nil]
# => ["c-call", "example.rb", 4, ...

Thread#set_trace_func(pr) -> Proc | nil (58.0)

スレッドにトレース用ハンドラを設定します。

スレッドにトレース用ハンドラを設定します。

nil を渡すとトレースを解除します。

設定したハンドラを返します。

//emlist[例][ruby]{
th = Thread.new do
class Trace
end
2.to_s
Thread.current.set_trace_func nil
3.to_s
end
th.set_trace_func lambda {|*arg| p arg }
th.join

# => ["line", "example.rb", 2, nil, #<Binding:0x00007fc8de87cb08>, nil]
#...

Object#class -> Class (40.0)

レシーバのクラスを返します。

レシーバのクラスを返します。

//emlist[][ruby]{
p "ruby".class #=> String
p 100.class #=> Integer
p ARGV.class #=> Array
p self.class #=> Object
p Class.class #=> Class
p Kernel.class #=> Module
//}

@see Class#superclass,Object#kind_of?,Object#instance_of?

絞り込み条件を変える

Object#method(name) -> Method (40.0)

オブジェクトのメソッド name をオブジェクト化した Method オブジェクトを返します。

オブジェクトのメソッド name をオブジェクト化した
Method オブジェクトを返します。

@param name メソッド名をSymbol またはStringで指定します。
@raise NameError 定義されていないメソッド名を引数として与えると発生します。

//emlist[][ruby]{
me = -365.method(:abs)
p me #=> #<Method: Integer#abs>
p me.call #=> 365
//}

@see Module#instance_method, Method, BasicObject#__send__, Objec...