るりまサーチ

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

別のキーワード

  1. _builtin times
  2. integer times
  3. process times
  4. times _builtin

ライブラリ

モジュール

検索結果

<< < ... 7 8 9 >>

ThreadsWait.new(*threads) -> ThreadsWait (6.0)

指定されたスレッドの終了をまつための、スレッド同期オブジェクトをつくります。

...す。

@param threads 終了を待つスレッドを一つもしくは複数指定します。

使用例
require 'thwait'

threads = []
5.times {|i|
threads << Thread.new { sleep 1; p Thread.current }
}

thall = ThreadsWait.new(*threads)
thall.all_waits{|th|
printf("end %s\n"...

bigdecimal (6.0)

bigdecimal は浮動小数点数演算ライブラリです。 任意の精度で 10 進表現された浮動小数点数を扱えます。

...指定することができます。

//emlist[pi.rb][ruby]{
#!/usr/local/bin/ruby

require "bigdecimal"
#
# Calculates 3.1415.... (the number of times that a circle's diameter
# will fit around the circle) using J. Machin's formula.
#
def big_pi(sig) # sig: Number of significant figures
exp =...

coverage (6.0)

カバレッジを測定するためのライブラリです。

...とするハッシュを返します。

==== 簡単な例

まず測定対象のソースを用意します。

//emlist[foo.rb][ruby]{
s = 0
10.times do |x|
s += x
end

if s == 45
p :ok
else
p :ng
end
//}

以下のようにして測定を行います。

//emlist[][ruby]{
require "coverage"...

クラス/メソッドの定義 (6.0)

クラス/メソッドの定義 * クラス/メソッドの定義: * class * singleton_class * module * method * operator * nest_method * eval_method * singleton_method * class_method * limit * 定義に関する操作: * alias * undef * defined

...す。
ブロックが与えられなかった場合のブロック引数の値はnilです。

//emlist[例][ruby]{
def foo(cnt, &block_arg)
cnt.times { block_arg.call } # ブロックに収まったProcオブジェクトはcallで実行
end
foo(3) { print "Ruby! " } #=> Ruby! Ruby! Ruby!
//}...

制御構造 (6.0)

制御構造 条件分岐: * if * unless * case 繰り返し: * while * until * for * break * next * redo * retry 例外処理: * raise * begin その他: * return * BEGIN * END

...D ブロックが登録される
わけではありません。そのような目的には Kernel.#at_exit を使
います。

//emlist[][ruby]{
5.times do |i|
END { p i }
end
# => 0
//}

END をメソッド定義式中に書くと警告が出ます。
意図的にこのようなことを行い...

絞り込み条件を変える

変数と定数 (6.0)

変数と定数 * local * instance * class * class_var_scope * global * pseudo * const * prio

...手続きオブジェクト
間ではローカル変数は共有されます。

//emlist[][ruby]{
# (A) の部分はスコープに入らない
2.times {
p defined?(v) # (A)
v = 1 # ここ(宣言開始)から
p v # ここ(ブロックの終り)までが v のスコ...

Array#*(sep) -> String (3.0)

指定された sep を間にはさんで連結した文字列を生成して返します。Array#join(sep) と同じ動作をします。

指定された sep を間にはさんで連結した文字列を生成して返します。Array#join(sep) と同じ動作をします。

@param sep 文字列を指定します。
文字列以外のオブジェクトを指定した場合は to_str メソッドによ
る暗黙の型変換を試みます。

//emlist[例][ruby]{
p [1,2,3] * ","
# => "1,2,3"
//}

@see Array#join
<< < ... 7 8 9 >>