種類
- モジュール関数 (52)
- インスタンスメソッド (20)
キーワード
- Rational (2)
-
check
_ signedness (2) -
check
_ sizeof (6) -
convertible
_ int (4) - fork (6)
- format (3)
- getopts (1)
- parseArgs (1)
- putc (3)
- rand (3)
- sleep (6)
- spawn (8)
- sprintf (3)
- srand (6)
- syscall (3)
- test (6)
-
try
_ constant (6)
検索結果
先頭5件
-
Kernel
. # Integer(arg) -> Integer (18335) -
引数を整数(Fixnum,Bignum)に変換した結果を返します。
...が整数(Integerのサブクラス)を返さなかった場合に発生します。
p Integer(4) #=> 4
p Integer(4_000) #=> 4000
p Integer(9.88) #=> 9
p Integer(nil) #=> 0
p Integer(Object.new) # cannot convert Object into Integer (TypeError)......10
p Integer("0d10") #=> 10
p Integer("010") #=> 8
p Integer("0o10") #=> 8
p Integer("0x10") #=> 16
p Integer("0b10") #=> 2
p Integer(" \n10\t ") #=> 10 # 空白類は無視される
p Integer("hoge") # `Integer': invalid value for Integer: "hoge"......(ArgumentError)
p Integer("") # `Integer': invalid value for Integer: "" (ArgumentError)
@see String#hex,String#oct,String#to_i,Integer......to_i
が整数(Integerのサブクラス)を返さなかった場合に発生します。
@raise TypeError 引数に nil を指定した場合に発生します。
p Integer(4) #=> 4
p Integer(4_000) #=> 4000
p Integer(9.88) #=> 9
p Integer(nil) # c......ert nil into Integer (TypeError)
p Integer(Object.new) # cannot convert Object into Integer (TypeError)
p Integer("10") #=> 10
p Integer("0d10") #=> 10
p Integer("010") #=> 8
p Integer("0o10") #=> 8
p Integer("0x10") #=> 16
p Integer("0b10")......#=> 2
p Integer(" \n10\t ") #=> 10 # 空白類は無視される
p Integer("hoge") # `Integer': invalid value for Integer: "hoge" (ArgumentError)
p Integer("") # `Integer': invalid value for Integer: "" (ArgumentError)
@see String#hex,String#oct,String#to_i,Integer... -
Kernel
. # test(cmd , file) -> bool | Time | Integer | nil (108) -
単体のファイルでファイルテストを行います。
...: ?z
ファイルサイズが 0 である
: ?s
ファイルサイズが 0 でない (ファイルサイズを返す、0 ならば nil) -> Integer|nil
: ?f
ファイルはプレーンファイルである
: ?d
ファイルはディレクトリである
: ?l
ファイルはシン... -
Kernel
. # spawn(command , options={}) -> Integer (105) -
引数を外部コマンドとして実行しますが、生成した 子プロセスの終了を待ち合わせません。生成した子プロセスのプロセスIDを返します。
...表す Hash
@param options オプションパラメータ Hash
@raise Errno::EXXX 起動に失敗し、ruby インタプリタに制御が戻った場合に発生します。
@raise Errno::EXXX コマンドが実行できなかった場合に発生します。
@see Kernel.#system,Kernel.#exec... -
Kernel
. # spawn(env , command , options={}) -> Integer (105) -
引数を外部コマンドとして実行しますが、生成した 子プロセスの終了を待ち合わせません。生成した子プロセスのプロセスIDを返します。
...表す Hash
@param options オプションパラメータ Hash
@raise Errno::EXXX 起動に失敗し、ruby インタプリタに制御が戻った場合に発生します。
@raise Errno::EXXX コマンドが実行できなかった場合に発生します。
@see Kernel.#system,Kernel.#exec... -
Kernel
. # spawn(env , program , *args , options={}) -> Integer (105) -
引数を外部コマンドとして実行しますが、生成した 子プロセスの終了を待ち合わせません。生成した子プロセスのプロセスIDを返します。
...列を指定します。
@param options オプションパラメータ Hash
@raise ArgumentError 第一引数が配列かつ要素数が 2 でない場合に発生します。
@raise Errno::EXXX コマンドが実行できなかった場合に発生します。
@see Kernel.#system,Kernel.#exec... -
Kernel
. # spawn(program , *args) -> Integer (105) -
引数を外部コマンドとして実行しますが、生成した 子プロセスの終了を待ち合わせません。生成した子プロセスのプロセスIDを返します。
...列を指定します。
@param options オプションパラメータ Hash
@raise ArgumentError 第一引数が配列かつ要素数が 2 でない場合に発生します。
@raise Errno::EXXX コマンドが実行できなかった場合に発生します。
@see Kernel.#system,Kernel.#exec... -
Kernel
# check _ sizeof(type , headers = nil) -> Integer | nil (103) -
与えられた型のサイズを返します。
与えられた型のサイズを返します。
型 type がシステムに存在する場合は、グローバル変数 $defs に
"-DSIZEOF_type=X" を追加し、型のサイズを返します。型 type がシステムに
存在しない場合は、nil を返します。
例えば、
check_sizeof('mystruct') # => 12
である場合、SIZEOF_MYSTRUCT=12 というプリプロセッサマクロをコンパイラに渡します。
@param type 検査したい型を指定します。
@param headers 追加のヘッダファイルを指定します。 -
Kernel
# check _ sizeof(type , headers = nil) { . . . } -> Integer | nil (103) -
与えられた型のサイズを返します。
与えられた型のサイズを返します。
型 type がシステムに存在する場合は、グローバル変数 $defs に
"-DSIZEOF_type=X" を追加し、型のサイズを返します。型 type がシステムに
存在しない場合は、nil を返します。
例えば、
check_sizeof('mystruct') # => 12
である場合、SIZEOF_MYSTRUCT=12 というプリプロセッサマクロをコンパイラに渡します。
@param type 検査したい型を指定します。
@param headers 追加のヘッダファイルを指定します。 -
Kernel
# try _ constant(const , headers = nil , opt = "") -> Integer | nil (103) -
定数 const がシステムに存在するかどうか検査します。 Kernel#have_const を使ってください。
...定数 const がシステムに存在するかどうか検査します。
Kernel#have_const を使ってください。
@param const C 言語の定数名を指定します。
@param headers 追加のヘッダファイルを指定します。
@param opt コンパイラに渡すオプションを... -
Kernel
# try _ constant(const , headers = nil , opt = "") { . . . } -> Integer | nil (103) -
定数 const がシステムに存在するかどうか検査します。 Kernel#have_const を使ってください。
...定数 const がシステムに存在するかどうか検査します。
Kernel#have_const を使ってください。
@param const C 言語の定数名を指定します。
@param headers 追加のヘッダファイルを指定します。
@param opt コンパイラに渡すオプションを... -
Kernel
. # fork -> Integer | nil (103) -
fork(2) システムコールを使ってプロセスの複製を作 ります。親プロセスでは子プロセスのプロセスIDを、子プロセスでは nil を返します。ブロックを指定して呼び出した場合には、生成し た子プロセスでブロックを評価します。
fork(2) システムコールを使ってプロセスの複製を作
ります。親プロセスでは子プロセスのプロセスIDを、子プロセスでは
nil を返します。ブロックを指定して呼び出した場合には、生成し
た子プロセスでブロックを評価します。
fork 前に STDOUT と STDERR を IO#flush します。
@raise NotImplementedError 実行環境がこのメソッドに対応していないとき発生します。
@see IO.popen,IO.pipe, fork(2) -
Kernel
. # fork { . . . } -> Integer | nil (103) -
fork(2) システムコールを使ってプロセスの複製を作 ります。親プロセスでは子プロセスのプロセスIDを、子プロセスでは nil を返します。ブロックを指定して呼び出した場合には、生成し た子プロセスでブロックを評価します。
fork(2) システムコールを使ってプロセスの複製を作
ります。親プロセスでは子プロセスのプロセスIDを、子プロセスでは
nil を返します。ブロックを指定して呼び出した場合には、生成し
た子プロセスでブロックを評価します。
fork 前に STDOUT と STDERR を IO#flush します。
@raise NotImplementedError 実行環境がこのメソッドに対応していないとき発生します。
@see IO.popen,IO.pipe, fork(2) -
Kernel
. # sleep -> Integer (103) -
sec 秒だけプログラムの実行を停止します。
sec 秒だけプログラムの実行を停止します。
sec が省略された場合、他スレッドからの Thread#run
などで明示的に起こさない限り永久にスリープします。Thread#runを呼ぶとその時点で
sleepの実行が中断されます。
@param sec 停止する秒数を非負の数値で指定します。浮動小数点数も指定できます。
省略された場合、永久にスリープします。
@return 実際に停止していた秒数 (整数に丸められた値) です。
it = Thread.new do
sleep
puts 'it_end'
end
re =... -
Kernel
. # sleep(sec) -> Integer (103) -
sec 秒だけプログラムの実行を停止します。
sec 秒だけプログラムの実行を停止します。
sec が省略された場合、他スレッドからの Thread#run
などで明示的に起こさない限り永久にスリープします。Thread#runを呼ぶとその時点で
sleepの実行が中断されます。
@param sec 停止する秒数を非負の数値で指定します。浮動小数点数も指定できます。
省略された場合、永久にスリープします。
@return 実際に停止していた秒数 (整数に丸められた値) です。
it = Thread.new do
sleep
puts 'it_end'
end
re =... -
Kernel
. # srand -> Integer (103) -
Kernel.#rand の乱数の種を設定し、古い種を返します。
...
Kernel.#rand の乱数の種を設定し、古い種を返します。
seed.to_i(引数の整数表現)を乱数の種に設定します。
seed に既知の値を与えると、以前の Kernel.#rand の値を再現できます。
初期値 seed が省略された時には
現在の時刻や......93347
p rand(0) #=> 0.915824970865251
seeds << srand(num)
p rand(6) #=> 3
p rand(6) #=> 0
p rand(0) #=> 0.445804380918972
p rand(0) #=> 0.422248634121701
seeds << srand
p seeds #=> [455675, 2995620310703489221660585195204777696, 455675]
@see Kernel.#rand, Object#to_int... -
Kernel
. # srand(seed) -> Integer (103) -
Kernel.#rand の乱数の種を設定し、古い種を返します。
...
Kernel.#rand の乱数の種を設定し、古い種を返します。
seed.to_i(引数の整数表現)を乱数の種に設定します。
seed に既知の値を与えると、以前の Kernel.#rand の値を再現できます。
初期値 seed が省略された時には
現在の時刻や......93347
p rand(0) #=> 0.915824970865251
seeds << srand(num)
p rand(6) #=> 3
p rand(6) #=> 0
p rand(0) #=> 0.445804380918972
p rand(0) #=> 0.422248634121701
seeds << srand
p seeds #=> [455675, 2995620310703489221660585195204777696, 455675]
@see Kernel.#rand, Object#to_int... -
Kernel
# getopts(single _ opts , *long _ opts) -> Integer | nil (102) -
このメソッドは obsolete です。 optparse ライブラリで提供されている ARGV.getopts を使ってください。Kernel::ARGV, OptionParser::Arguable#getopts を参照。
...このメソッドは obsolete です。
optparse ライブラリで提供されている
ARGV.getopts を使ってください。Kernel::ARGV, OptionParser::Arguable#getopts を参照。
指定された short_opt や long_opt に応じて ARGV を解析し、
結果をそれぞれのグローバ... -
Kernel
# parseArgs(min _ argc , check _ opts , single _ opts , *opts) -> Integer | nil (102) -
コマンドラインオプションを解析し、対応するグローバル変数 $OPT_xxx に値を設定します。
コマンドラインオプションを解析し、対応するグローバル変数 $OPT_xxx に値を設定します。
また、指定したオプションが条件にあっていない場合はグローバル変数 $USAGE の値を eval します。
@param min_argc `-' や `--' を伴って指定するオプション以外のオプションの
最低必要数を指定します。存在しない場合は 0 を指定します。
@param check_opts どのオプションが必要条件かを指定します.第 3、第 4 引数で指定する
オプションのうち必要なものを '(',')','|... -
Kernel
. # rand(max = 0) -> Integer|Float (102) -
擬似乱数を得るメソッドです。
...をランダムに返します。
また 0 の場合、0.0 以上 1.0 未満の範囲の浮動小数点数をランダムに返します。
まだ Kernel.#srand が呼ばれていなければ自動的に呼び出します。
@param max 数値オブジェクトです。
p rand(63) #=> 20
p ran......d(63) #=> 56
p rand(0) #=> 0.341033520223401
p rand(0) #=> 0.31341550089985
p rand(-5) #=> 2
p rand(0.9) #=> 0.195303845149051
p rand(1.5) #=> 0
@see Kernel.#srand, Object#to_int, Numeric#abs... -
Kernel
. # syscall(num , *arg) -> Integer (102) -
numで指定された番号のシステムコールを実行します。 第2引数以降をシステムコールの引数として渡します。
numで指定された番号のシステムコールを実行します。
第2引数以降をシステムコールの引数として渡します。
どの数値がどのシステムコールに対応するかは、
syscall(2) や
/usr/include/sys/syscall.h を参照してください。
システムコールの慣習に従い、syscall(2)
が -1 を返す場合には例外 Errno::EXXX が発生します。
それ以外では、返した値をそのまま数値で返します。
ライブラリ dl を使えばより高レベルな操作ができます。
@param num システムコール番号です。
@param arg 文字列か、整数です。最大 9 個まで渡... -
Kernel
# convertible _ int(type , headers = nil , opts = nil) (49) -
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......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",... -
Kernel
# convertible _ int(type , headers = nil , opts = nil) { . . . } (49) -
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......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",... -
Kernel
# check _ signedness(type , headers = nil , opts = nil) -> "signed" | "unsigned" | nil (33) -
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.
...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 returne... -
Kernel
# check _ signedness(type , headers = nil , opts = nil) { . . . } -> "signed" | "unsigned" | nil (33) -
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.
...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 returne... -
Kernel
. # Rational(x , y = 1) -> Rational (7) -
引数を有理数(Rational)に変換した結果を返します。
...コアで繋いだ形式
"1.2/3" のように、分子を実数にする事も可能ですが、分母には指定できませ
ん。また、Kernel.#Integer とは違い "0x10" のような進数を表す接頭
辞を含めた指定は行えません。
例:
Rational("1/3") # => (1/3)... -
Kernel
. # format(format , *arg) -> String (7) -
format 文字列を C 言語の sprintf と同じように解釈し、 引数をフォーマットした文字列を返します。
...トした文字列を返します。
@param format フォーマット文字列です。
@param arg フォーマットされる引数です。
@see Kernel.#printf,Time#strftime,Date.strptime
==== sprintf フォーマット
Ruby の sprintf フォーマットは基本的に C 言語の sprintf(3)......p", /e+/) #=> "/e+/"
//}
: d
: i
引数の数値を10進表現の整数として出力します。
引数が整数でなければ関数 Kernel.#Integer と同じ規則で整数に
変換されます。
//emlist{
p sprintf("%d", -1) #=> "-1"
p sprintf("%d", 3.1) #=> "3"
p sprintf("%d",... -
Kernel
. # putc(ch) -> object (7) -
文字 ch を 標準出力 $stdout に出力します。
...用にオープンされていなければ発生します。
@raise Errno::EXXX 出力に失敗した場合に発生します。
@raise TypeError Integer に変換できないオブジェクトを引数に
指定した場合に発生します。
putc("ch")
putc(?c)
putc... -
Kernel
. # sprintf(format , *arg) -> String (7) -
format 文字列を C 言語の sprintf と同じように解釈し、 引数をフォーマットした文字列を返します。
...トした文字列を返します。
@param format フォーマット文字列です。
@param arg フォーマットされる引数です。
@see Kernel.#printf,Time#strftime,Date.strptime
==== sprintf フォーマット
Ruby の sprintf フォーマットは基本的に C 言語の sprintf(3)......p", /e+/) #=> "/e+/"
//}
: d
: i
引数の数値を10進表現の整数として出力します。
引数が整数でなければ関数 Kernel.#Integer と同じ規則で整数に
変換されます。
//emlist{
p sprintf("%d", -1) #=> "-1"
p sprintf("%d", 3.1) #=> "3"
p sprintf("%d",... -
Kernel
. # test(cmd , file1 , file2) -> bool (3) -
2ファイル間のファイルテストを行います。
2ファイル間のファイルテストを行います。
@param cmd 以下に示す数値リテラルか文字列です(文字列の場合はその先頭の文字だけをコマンドとみなします)。
@param file1 テストするファイルオブジェクトです。
@param file2 テストするファイルオブジェクトです。
@return 真偽値を返します。
以下は cmd として指定できる数値リテラルとその意味です。
: ?=
ファイル1とファイル2の最終更新時刻が等しい
: ?>
ファイル1の方がファイル2より最終更新時刻が新しい
: ?<
ファイル1の方がファイル2より最終更新時刻が古い
: ...
