るりまサーチ

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

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

ライブラリ

クラス

モジュール

キーワード

検索結果

Integer#times -> Enumerator (35132.0)

self 回だけ繰り返します。 self が正の整数でない場合は何もしません。

...れます。

//emlist[][ruby]{
3.times { puts "Hello, World!" } # Hello, World! と3行続いて表示される。
0.times { puts "Hello, World!" } # 何も表示されない。
5.times {|n| print n } # 01234 と表示される。
//}

@see Integer#upto, Integer#downto, Numeric#step...

Integer#times {|n| ... } -> self (35132.0)

self 回だけ繰り返します。 self が正の整数でない場合は何もしません。

...れます。

//emlist[][ruby]{
3.times { puts "Hello, World!" } # Hello, World! と3行続いて表示される。
0.times { puts "Hello, World!" } # 何も表示されない。
5.times {|n| print n } # 01234 と表示される。
//}

@see Integer#upto, Integer#downto, Numeric#step...

Integer#upto(max) {|n| ... } -> Integer (17119.0)

self から max まで 1 ずつ増やしながら繰り返します。 self > max であれば何もしません。

...self から max まで 1 ずつ増やしながら繰り返します。
self > max であれば何もしません。

@param max 数値
@return self を返します。

//emlist[][ruby]{
5.upto(10) {|i| print i, " " } # => 5 6 7 8 9 10
//}

@see Integer#downto, Numeric#step, Integer#times...

Integer#upto(max) -> Enumerator (17019.0)

self から max まで 1 ずつ増やしながら繰り返します。 self > max であれば何もしません。

...self から max まで 1 ずつ増やしながら繰り返します。
self > max であれば何もしません。

@param max 数値
@return self を返します。

//emlist[][ruby]{
5.upto(10) {|i| print i, " " } # => 5 6 7 8 9 10
//}

@see Integer#downto, Numeric#step, Integer#times...

Integer#downto(min) -> Enumerator (17018.0)

self から min まで 1 ずつ減らしながらブロックを繰り返し実行します。 self < min であれば何もしません。

...で 1 ずつ減らしながらブロックを繰り返し実行します。
self < min であれば何もしません。

@param min 数値
@return self を返します。

//emlist[][ruby]{
5.downto(1) {|i| print i, " " } # => 5 4 3 2 1
//}

@see Integer#upto, Numeric#step, Integer#times...

絞り込み条件を変える

Integer#downto(min) {|n| ... } -> self (17018.0)

self から min まで 1 ずつ減らしながらブロックを繰り返し実行します。 self < min であれば何もしません。

...で 1 ずつ減らしながらブロックを繰り返し実行します。
self < min であれば何もしません。

@param min 数値
@return self を返します。

//emlist[][ruby]{
5.downto(1) {|i| print i, " " } # => 5 4 3 2 1
//}

@see Integer#upto, Numeric#step, Integer#times...

Process.#clock_gettime(clock_id, unit=:float_second) -> Float | Integer (8155.0)

POSIX の clock_gettime() 関数の時間を返します。

...れかで指定します。
サポートされている定数は OS やバージョンに依存します。

: Process::CLOCK_REALTIME
S
USv2 to 4, Linux 2.5.63, FreeBSD 3.0, NetBSD 2.0, OpenBSD 2.1, macOS 10.12
: Process::CLOCK_MONOTONIC
SUSv3 to 4, Linux 2.5.63, FreeBSD 3.0, NetBS...
...:GETTIMEOFDAY_BASED_CLOCK_REALTIME と定義されています。

CLOCK_REALTIME のエミュレーション:

: :GETTIMEOFDAY_BASED_CLOCK_REALTIME
S
US で定義されている gettimeofday() を使います。 (しかし SUSv4 で obsoleted になっています)
精度は1マイクロ秒です...
...可能な mach_absolute_time() を使います。
精度は CPU に依存します。
: :TIMES_BASED_CLOCK_MONOTONIC
POSIX で定義されている times() の結果を使います。
POSIX では「times() は過去のある時点 (例えばシステムの起動時刻) からの経過クロッ...

Process.#waitall -> [[Integer, Process::Status]] (8107.0)

全ての子プロセスが終了するのを待ちます。 終了した子プロセスの pid と終了ステータス (Process::Status) の配列の配列を返します。 子プロセスがいない状態でこのメソッドを呼び出すと空の配列を返します。

...空の配列を返します。

$? には最後に終了した子プロセスの Process::Status オブジェクトが設定されます。

2.times {|n|
Process.fork() { exit n }
}
p Process.waitall
#=> :Status: pid=2766,exited(1)>], [2765, #<Process::Status: pid=2765,exited(1...

Numeric (8082.0)

数値を表す抽象クラスです。Integer や Float などの数値クラス は Numeric のサブクラスとして実装されています。

...数値を表す抽象クラスです。Integer や Float などの数値クラス
は Numeric のサブクラスとして実装されています。

演算や比較を行うメソッド(+, -, *, /, <=>)は Numeric のサブクラスで定義されま
す。Numeric で定義されているメソッ...
...れのクラスを参照してください。


=> ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
Numeric Integer Fixnum Bignum Float Rational Complex
------------------------------------------------------------------------------...
...o o
< | - - o o o - -
Numeric Integer Fixnum Bignum Float Rational Complex
-----------------------------------------------------------------------------...
...クラスを参照してください。


=> ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-darwin15]
Numeric Integer Float Rational Complex
--------------------------------------------------------------------------------
% |...
...o o o
< | - o o - -
Numeric Integer Float Rational Complex
--------------------------------------------------------------------------------
<< |...