モジュール
キーワード
- BigDecimal (14)
- Integer (7)
- Rational (7)
-
clock
_ gettime (12) -
each
_ object (48) - facility (12)
- fork (24)
- getpty (24)
- getrlimit (12)
- ident (12)
- mask (12)
- mask= (12)
-
memsize
_ of _ all (12) - rand (24)
- size? (12)
- spawn (72)
- sqrt (12)
- sysconf (12)
- test (24)
- wait (12)
- wait2 (12)
- waitall (12)
- waitpid (12)
- waitpid2 (12)
-
world
_ readable? (12)
検索結果
先頭5件
-
Kernel
. # Integer(arg , base = 0 , exception: true) -> Integer | nil (6460.0) -
引数を整数 (Fixnum,Bignum) に変換した結果を返します。
...o_i
が整数(Integerのサブクラス)を返さなかった場合に発生します。
@raise TypeError 引数に nil を指定した場合に発生します。
//emlist[例][ruby]{
p Integer(4) #=> 4
p Integer(4_000) #=> 4000
p Integer(9.88) #=> 9
p Integer(nil) # c......nvert nil into Integer (TypeError)
p Integer(Object.new) # cannot convert Object into Integer (TypeError)
p Integer("10") #=> 10
p Integer("10", 2) #=> 2
p Integer("0d10") #=> 10
p Integer("010") #=> 8
p Integer("0o10") #=> 8
p Integer("0x10") #=> 16
p Integer("0b10")......尾の空白類は無視される
p Integer("1\n0") # `Integer': invalid value for Integer: "1\n0" (ArgumentError)
p Integer("hoge") # `Integer': invalid value for Integer: "hoge" (ArgumentError)
p Integer("") # `Integer': invalid value for Integer: "" (ArgumentError)
//}
@see Strin... -
Kernel
. # test(cmd , file) -> bool | Time | Integer | nil (419.0) -
単体のファイルでファイルテストを行います。
...: ?z
ファイルサイズが 0 である
: ?s
ファイルサイズが 0 でない (ファイルサイズを返す、0 ならば nil) -> Integer|nil
: ?f
ファイルはプレーンファイルである
: ?d
ファイルはディレクトリである
: ?l
ファイルはシン... -
Kernel
. # rand(range) -> Integer | Float | nil (306.0) -
擬似乱数を発生させます。
擬似乱数を発生させます。
最初の形式では
max が 0 の場合は 0.0 以上 1.0 未満の実数を、正の整数の場合は 0 以上 max 未満の整数を返します。
それ以外の値を指定した場合は max.to_int の絶対値が指定されたものとして扱います。
二番目の形式では range で指定された範囲の値を返します。
range の始端と終端が共に整数の場合は整数を、少なくとも片方が実数の場合は実数を返します。
range に含まれる数が無い場合は nil を返します。
まだ Kernel.#srand が呼ばれていなければ自動的に呼び出します。
擬似乱数生成器として Random... -
ObjectSpace
. # each _ object {|object| . . . } -> Integer (241.0) -
指定された klass と Object#kind_of? の関係にある全ての オブジェクトに対して繰り返します。引数が省略された時には全てのオブ ジェクトに対して繰り返します。 繰り返した数を返します。
...ace:each_object(false)>
//}
//emlist[例: 全てのオブジェクトを扱う][ruby]{
ObjectSpace.each_object.take(5).each { |x| p x }
count = ObjectSpace.each_object { |x| x }
puts "Total count: #{count}"
# => "scope"
# => "scopes"
# => "sym"
# => "class_names"
# => "@corrections"
# => Total cou......st[例: 任意のクラスを扱う][ruby]{
Person = Struct.new(:name)
s1 = Person.new("tanaka")
s2 = Person.new("sato")
count = ObjectSpace.each_object(Person) { |x| p x }
puts "Total count: #{count}"
# => #<struct Person name="sato">
# => #<struct Person name="tanaka">
# => Total count: 2
//}... -
ObjectSpace
. # each _ object(klass) {|object| . . . } -> Integer (241.0) -
指定された klass と Object#kind_of? の関係にある全ての オブジェクトに対して繰り返します。引数が省略された時には全てのオブ ジェクトに対して繰り返します。 繰り返した数を返します。
...ace:each_object(false)>
//}
//emlist[例: 全てのオブジェクトを扱う][ruby]{
ObjectSpace.each_object.take(5).each { |x| p x }
count = ObjectSpace.each_object { |x| x }
puts "Total count: #{count}"
# => "scope"
# => "scopes"
# => "sym"
# => "class_names"
# => "@corrections"
# => Total cou......st[例: 任意のクラスを扱う][ruby]{
Person = Struct.new(:name)
s1 = Person.new("tanaka")
s2 = Person.new("sato")
count = ObjectSpace.each_object(Person) { |x| p x }
puts "Total count: #{count}"
# => #<struct Person name="sato">
# => #<struct Person name="tanaka">
# => Total count: 2
//}... -
Process
. # clock _ gettime(clock _ id , unit=:float _ second) -> Float | Integer (227.0) -
POSIX の clock_gettime() 関数の時間を返します。
...at_millisecond
Float のミリ秒
: :float_microsecond
Float のマイクロ秒
: :second
Integer の秒
: :millisecond
Integer のミリ秒
: :microsecond
Integer のマイクロ秒
: :nanosecond
Integer のナノ秒
基になる関数 clock_gettime() はナノ秒を返します。
Float オ... -
Syslog
. # mask -> Integer | nil (227.0) -
ログの優先度のマスクを取得または設定します。 マスクは永続的であり、 Syslog.openやSyslog.close ではリセットされません。
...pen('ftpd', LOG_PID | LOG_NDELAY, LOG_FTP)
Syslog.mask = Syslog::LOG_UPTO(LOG_ERR)
[ LOG_CRIT, LOG_ERR, LOG_WARNING,
LOG_NOTICE, LOG_INFO, LOG_DEBUG ].each_with_index { |c, i|
Syslog.log(c, "test for syslog FTP #{c}, #{i}")
}
Syslog.close
File.foreach(log){|line|
print line if... -
Process
. # wait(pid = -1 , flags = 0) -> Integer | nil (209.0) -
pid で指定される特定の子プロセスの終了を待ち、そのプロセスが 終了した時に pid を返します。 wait2, waitpid2 は子プロセスの pid と終了ステータスを表す Process::Status オブジェクトの配列を返します。 ノンブロッキングモードで子プロセスがまだ終了していない時には nil を返します。
pid で指定される特定の子プロセスの終了を待ち、そのプロセスが
終了した時に pid を返します。
wait2, waitpid2 は子プロセスの pid と終了ステータスを表す
Process::Status オブジェクトの配列を返します。
ノンブロッキングモードで子プロセスがまだ終了していない時には
nil を返します。
$? に終了した子プロセスの Process::Status オブジェクトがセットされます。
@param pid 子プロセスのプロセス ID を整数で指定します。
0 以上なら指定されたプロセス ID の子プロセスを待ちます。
0 な... -
Process
. # wait2(pid = -1 , flags = 0) -> [Integer , Process :: Status] | nil (209.0) -
pid で指定される特定の子プロセスの終了を待ち、そのプロセスが 終了した時に pid を返します。 wait2, waitpid2 は子プロセスの pid と終了ステータスを表す Process::Status オブジェクトの配列を返します。 ノンブロッキングモードで子プロセスがまだ終了していない時には nil を返します。
pid で指定される特定の子プロセスの終了を待ち、そのプロセスが
終了した時に pid を返します。
wait2, waitpid2 は子プロセスの pid と終了ステータスを表す
Process::Status オブジェクトの配列を返します。
ノンブロッキングモードで子プロセスがまだ終了していない時には
nil を返します。
$? に終了した子プロセスの Process::Status オブジェクトがセットされます。
@param pid 子プロセスのプロセス ID を整数で指定します。
0 以上なら指定されたプロセス ID の子プロセスを待ちます。
0 な...