ライブラリ
クラス
-
ARGF
. class (24) - Array (24)
- Binding (11)
- Coverage (7)
- Enumerator (36)
-
Enumerator
:: Lazy (48) - Float (22)
- IO (12)
- Integer (72)
- Object (48)
-
Rake
:: FileCreationTask (12) -
Rake
:: FileTask (12) -
Rake
:: Task (12) - Socket (48)
-
Socket
:: AncillaryData (12) - String (12)
- Thread (18)
-
Thread
:: ConditionVariable (24) - ThreadsWait (60)
モジュール
- Benchmark (36)
- Etc (12)
- Kernel (24)
- Process (36)
-
Socket
:: Constants (48)
キーワード
- * (36)
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) - ERB (12)
- Fiber (12)
-
NEWS for Ruby 2
. 5 . 0 (8) -
NEWS for Ruby 3
. 0 . 0 (5) - Numeric (12)
-
PC
_ TIMESTAMP _ RESOLUTION (12) - Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (12)
- Rubyの起動 (12)
-
SCM
_ TIMESTAMP (24) -
SCM
_ TIMESTAMPNS (24) -
SO
_ TIMESTAMP (24) -
SO
_ TIMESTAMPNS (24) - Symbol (1)
- ThreadGroup (12)
- Tms (12)
-
all
_ waits (18) -
at
_ exit (12) - benchmark (12)
- bigdecimal (12)
- bm (12)
- broadcast (12)
-
clock
_ gettime (12) - coverage (12)
- downto (24)
- empty? (6)
-
enum
_ for (48) - eof (12)
- eof? (12)
- finished? (6)
- join (6)
-
join
_ nowait (6) -
line
_ stub (7) -
local
_ variables (11) - measure (12)
- modified? (12)
- new (6)
- next (12)
-
next
_ float (11) -
next
_ wait (6) -
prev
_ float (11) -
rb
_ time _ timespec _ new (10) -
rb
_ timespec _ now (10) -
report
_ on _ exception (9) -
report
_ on _ exception= (9) - select (12)
- signal (12)
- threads (6)
-
to
_ enum (48) - upto (24)
- waitall (12)
-
with
_ object (24) - xmlrpc (3)
- クラス/メソッドの定義 (12)
- 制御構造 (12)
- 変数と定数 (12)
- 演算子式 (12)
検索結果
-
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