別のキーワード
ライブラリ
クラス
-
ARGF
. class (36) - Array (392)
- BasicObject (24)
- Binding (12)
- Dir (36)
-
Encoding
:: Converter (24) - Enumerator (36)
-
Enumerator
:: Lazy (48) - Exception (56)
- Fiber (42)
-
File
:: Stat (12) - Float (12)
- FrozenError (6)
- Hash (12)
- IO (32)
-
IRB
:: ExtendCommand :: Load (12) - Integer (87)
- MatchData (22)
- Matrix (50)
- Module (180)
- Mutex (2)
- Numeric (62)
- Object (108)
-
OpenSSL
:: BN (180) - OptionParser (276)
- Pathname (12)
-
Rake
:: InvocationChain (12) - Range (204)
- Rational (12)
- Set (60)
- String (206)
- StringIO (110)
- StringScanner (24)
- Struct (36)
- Thread (26)
-
Thread
:: Mutex (10) - TracePoint (62)
- WIN32OLE (36)
-
WIN32OLE
_ TYPELIB (12)
モジュール
- Comparable (72)
- Enumerable (156)
- Kernel (12)
-
OptionParser
:: Arguable (60)
キーワード
- ** (11)
- + (12)
- < (24)
- << (12)
- <= (24)
- <=> (12)
- == (24)
- === (12)
- > (24)
- >= (24)
- >> (12)
- [] (138)
- []= (60)
- antisymmetric? (7)
- append (12)
- at (12)
- backtrace (12)
-
backtrace
_ locations (12) - begin (24)
- between? (12)
- birthtime (12)
- bsearch (48)
- bytebegin (2)
- byteend (2)
- byteindex (3)
- byteoffset (6)
- bytes (14)
-
callee
_ id (12) - chunk (12)
- clamp (12)
-
class
_ variable _ get (12) -
clear
_ bit! (12) - clone (12)
- cmp (12)
- coerce (12)
-
cofactor
_ expansion (12) -
collect
_ concat (12) - combination (24)
-
const
_ get (12) - convert (12)
- cycle (24)
-
delete
_ at (12) - detect (24)
- digits (12)
-
each
_ byte (36) - end (12)
- entries (7)
-
enum
_ for (36) - eof (12)
- eof? (12)
- event (12)
- execute (12)
- feed (12)
- fetch (44)
-
fetch
_ values (2) - find (24)
- finish (12)
- first (36)
-
flat
_ map (12) - gem (12)
- getbyte (12)
- getopts (36)
- insert (12)
- inspect (12)
-
instance
_ eval (12) -
instruction
_ sequence (7) - intersection (6)
-
laplace
_ expansion (12) - last (36)
-
local
_ variable _ get (12) - max (94)
-
method
_ id (12) -
method
_ missing (12) - min (94)
-
mod
_ add (12) -
mod
_ exp (12) -
mod
_ inverse (12) -
mod
_ mul (12) -
mod
_ sub (12) - next (12)
-
ole
_ query _ interface (12) - on (144)
- order (48)
- order! (48)
- overlap? (2)
- parameters (7)
- parse! (12)
- path (12)
- peek (24)
- peep (12)
- permutation (12)
- permute (24)
- permute! (24)
- pop (12)
- pos= (12)
- pow (22)
- pread (8)
-
prime
_ fasttest? (12) - print (12)
- printf (12)
- private (48)
-
proper
_ subset? (12) -
proper
_ superset? (12) - public (36)
-
public
_ send (24) - puts (12)
- readbyte (36)
- receiver (6)
- regular? (12)
- rehash (12)
-
relative
_ path _ from (12) -
remove
_ class _ variable (12) -
remove
_ const (12) -
remove
_ instance _ variable (12) -
repeated
_ combination (24) -
report
_ on _ exception (9) -
report
_ on _ exception= (9) -
respond
_ to? (12) - resume (12)
-
return
_ value (12) - rewind (12)
- rotate (12)
- rotate! (12)
- rshift! (12)
- sample (24)
- seek (12)
-
set
_ backtrace (12) - setbyte (12)
- setproperty (24)
- shift (12)
-
skew
_ symmetric? (7) - slice (72)
- step (62)
- subset? (12)
- subtract (12)
- superset? (12)
- synchronize (12)
-
to
_ a (7) -
to
_ d (24) -
to
_ enum (36) -
to
_ s (24) - transfer (12)
- ucmp (12)
-
unicode
_ normalized? (11) -
values
_ at (12) - write (12)
- zip (24)
検索結果
先頭5件
-
Fiber
# raise(exception , message = nil , backtrace = nil) -> object (27440.0) -
selfが表すファイバーが最後に Fiber.yield を呼んだ場所で例外を発生させます。
...すファイバーが最後に Fiber.yield を呼んだ場所で例外を発生させます。
Fiber.yield が呼ばれていないかファイバーがすでに終了している場合、
FiberError が発生します。
引数を渡さない場合、RuntimeError が発生します。
message 引......数を渡した場合、message 引数をメッセージとした RuntimeError
が発生します。
その他のケースでは、最初の引数は Exception か Exception
のインスタンスを返す exception メソッドを持ったオブジェクトである
必要があります。
この......@param message 例外のメッセージとなる文字列です。
@param exception 発生させる例外です。
@param backtrace 例外発生時のスタックトレースです。文字列の配列で指定します。
//emlist[例][ruby]{
f = Fiber.new { Fiber.yield }
f.resume
f.raise "Error!"... -
Fiber
# raise -> object (27340.0) -
selfが表すファイバーが最後に Fiber.yield を呼んだ場所で例外を発生させます。
...すファイバーが最後に Fiber.yield を呼んだ場所で例外を発生させます。
Fiber.yield が呼ばれていないかファイバーがすでに終了している場合、
FiberError が発生します。
引数を渡さない場合、RuntimeError が発生します。
message 引......数を渡した場合、message 引数をメッセージとした RuntimeError
が発生します。
その他のケースでは、最初の引数は Exception か Exception
のインスタンスを返す exception メソッドを持ったオブジェクトである
必要があります。
この......@param message 例外のメッセージとなる文字列です。
@param exception 発生させる例外です。
@param backtrace 例外発生時のスタックトレースです。文字列の配列で指定します。
//emlist[例][ruby]{
f = Fiber.new { Fiber.yield }
f.resume
f.raise "Error!"... -
Fiber
# raise(message) -> object (27340.0) -
selfが表すファイバーが最後に Fiber.yield を呼んだ場所で例外を発生させます。
...すファイバーが最後に Fiber.yield を呼んだ場所で例外を発生させます。
Fiber.yield が呼ばれていないかファイバーがすでに終了している場合、
FiberError が発生します。
引数を渡さない場合、RuntimeError が発生します。
message 引......数を渡した場合、message 引数をメッセージとした RuntimeError
が発生します。
その他のケースでは、最初の引数は Exception か Exception
のインスタンスを返す exception メソッドを持ったオブジェクトである
必要があります。
この......@param message 例外のメッセージとなる文字列です。
@param exception 発生させる例外です。
@param backtrace 例外発生時のスタックトレースです。文字列の配列で指定します。
//emlist[例][ruby]{
f = Fiber.new { Fiber.yield }
f.resume
f.raise "Error!"... -
Exception
# backtrace _ locations -> [Thread :: Backtrace :: Location] (12419.0) -
バックトレース情報を返します。Exception#backtraceに似ていますが、 Thread::Backtrace::Location の配列を返す点が異なります。
...eption#backtraceに似ていますが、
Thread::Backtrace::Location の配列を返す点が異なります。
現状では Exception#set_backtrace によって戻り値が変化する事はあり
ません。
//emlist[例: test.rb][ruby]{
require "date"
def check_long_month(month)
return if Da......1
raise "#{month} is not long month"
end
def get_exception
return begin
yield
rescue => e
e
end
end
e = get_exception { check_long_month(2) }
p e.backtrace_locations
# => ["test.rb:4:in `check_long_month'", "test.rb:15:in `block in <main>'", "test.rb:9:in `get_exception'", "test.rb......:15:in `<main>'"]
//}
@see Exception#backtrace... -
Binding
# local _ variable _ get(symbol) -> object (12237.0) -
引数 symbol で指定した名前のローカル変数に設定された値を返します。
...bol で指定した名前のローカル変数に設定された値を返します。
@param symbol ローカル変数名を Symbol オブジェクトで指定します。
@raise NameError 引数 symbol で指定したローカル変数が未定義の場合に発生します。
//emlist[例][ruby......]{
def foo
a = 1
binding.local_variable_get(:a) # => 1
binding.local_variable_get(:b) # => NameError
end
//}
このメソッドは以下のコードの短縮形です。
//emlist[][ruby]{
binding.eval("#{symbol}")
//}
@see Binding#local_variable_set, Binding#local_variable_defined?... -
Array
# bsearch -> Enumerator (12231.0) -
ブロックの評価結果で範囲内の各要素の判定を行い、条件を満たす値を二分探 索(計算量は O(log n))で検索します。要素が見つからない場合は nil を返し ます。self はあらかじめソートしておく必要があります。
...: true を返す
* 求める値がブロックパラメータより後の要素の場合: false を返す
ブロックの評価結果が true になる最初の要素を返すか、nil を返します。
//emlist[例][ruby]{
ary = [0, 4, 7, 10, 12]
ary.bsearch {|x| x >= 4 } # => 4
ary.bsearch {......|x| x >= 6 } # => 7
ary.bsearch {|x| x >= -1 } # => 0
ary.bsearch {|x| x >= 100 } # => nil
//}
find-any モードは bsearch(3) のように動作します。ブロックは真偽値
ではなく、以下のような数値を返す必要があります。求める要素が配列の i 番目
か......ずれかの要素を返すか、nil を返します。
//emlist[例][ruby]{
ary = [0, 4, 7, 10, 12]
# 4 <= v < 8 になる要素を検索
ary.bsearch {|x| 1 - x / 4 } # => 4 or 7
# 8 <= v < 10 になる要素を検索
ary.bsearch {|x| 4 - x / 2 } # => nil
//}
上記の 2 つのモードを混在... -
Array
# bsearch { |x| . . . } -> object | nil (12231.0) -
ブロックの評価結果で範囲内の各要素の判定を行い、条件を満たす値を二分探 索(計算量は O(log n))で検索します。要素が見つからない場合は nil を返し ます。self はあらかじめソートしておく必要があります。
...: true を返す
* 求める値がブロックパラメータより後の要素の場合: false を返す
ブロックの評価結果が true になる最初の要素を返すか、nil を返します。
//emlist[例][ruby]{
ary = [0, 4, 7, 10, 12]
ary.bsearch {|x| x >= 4 } # => 4
ary.bsearch {......|x| x >= 6 } # => 7
ary.bsearch {|x| x >= -1 } # => 0
ary.bsearch {|x| x >= 100 } # => nil
//}
find-any モードは bsearch(3) のように動作します。ブロックは真偽値
ではなく、以下のような数値を返す必要があります。求める要素が配列の i 番目
か......ずれかの要素を返すか、nil を返します。
//emlist[例][ruby]{
ary = [0, 4, 7, 10, 12]
# 4 <= v < 8 になる要素を検索
ary.bsearch {|x| 1 - x / 4 } # => 4 or 7
# 8 <= v < 10 になる要素を検索
ary.bsearch {|x| 4 - x / 2 } # => nil
//}
上記の 2 つのモードを混在... -
Array
# repeated _ combination(n) -> Enumerator (12231.0) -
サイズ n の重複組み合わせをすべて生成し、それを引数としてブロックを実行 します。
...する Enumerator オブジェクトを返します。
@param n 生成される配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数に......指定した場合に発生します。
//emlist[例][ruby]{
a = [1, 2, 3]
a.repeated_combination(1).to_a #=> [[1], [2], [3]]
a.repeated_combination(2).to_a #=> [[1,1],[1,2],[1,3],[2,2],[2,3],[3,3]]
a.repeated_combination(3).to_a #=> [[1,1,1],[1,1,2],[1,1,3],[1,2,2],[1,2,3],......,[3,3,3]]
a.repeated_combination(4).to_a #=> [[1,1,1,1],[1,1,1,2],[1,1,1,3],[1,1,2,2],[1,1,2,3],
# [1,1,3,3],[1,2,2,2],[1,2,2,3],[1,2,3,3],[1,3,3,3],
# [2,2,2,2],[2,2,2,3],[2,2,3,3],[2,3,3,3],[3,3,3,3]]
a.repeated_combination(0).... -
Array
# repeated _ combination(n) { |c| . . . } -> self (12231.0) -
サイズ n の重複組み合わせをすべて生成し、それを引数としてブロックを実行 します。
...する Enumerator オブジェクトを返します。
@param n 生成される配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数に......指定した場合に発生します。
//emlist[例][ruby]{
a = [1, 2, 3]
a.repeated_combination(1).to_a #=> [[1], [2], [3]]
a.repeated_combination(2).to_a #=> [[1,1],[1,2],[1,3],[2,2],[2,3],[3,3]]
a.repeated_combination(3).to_a #=> [[1,1,1],[1,1,2],[1,1,3],[1,2,2],[1,2,3],......,[3,3,3]]
a.repeated_combination(4).to_a #=> [[1,1,1,1],[1,1,1,2],[1,1,1,3],[1,1,2,2],[1,1,2,3],
# [1,1,3,3],[1,2,2,2],[1,2,2,3],[1,2,3,3],[1,3,3,3],
# [2,2,2,2],[2,2,2,3],[2,2,3,3],[2,3,3,3],[3,3,3,3]]
a.repeated_combination(0).... -
Range
# bsearch -> Enumerator (12231.0) -
ブロックの評価結果で範囲内の各要素の大小判定を行い、条件を満たす値を二 分探索(計算量は O(log n))で検索します。要素が見つからない場合は nil を 返します。
...場合: true を返す
* 求める値がブロックパラメータより後の要素の場合: false を返す
ブロックの評価結果が true になる最初の要素を返すか、nil を返します。
//emlist[例][ruby]{
ary = [0, 4, 7, 10, 12]
(0...ary.size).bsearch {|i| ary[i] >= 4 }......# => 1
(0...ary.size).bsearch {|i| ary[i] >= 6 } # => 2
(0...ary.size).bsearch {|i| ary[i] >= 8 } # => 3
(0...ary.size).bsearch {|i| ary[i] >= 100 } # => nil
(0.0...Float::INFINITY).bsearch {|x| Math.log(x) >= 0 } # => 1.0
//}
find-any モードは bsearch(3) のように動作します。ブロ......][ruby]{
ary = [0, 100, 100, 100, 200]
(0..4).bsearch {|i| 100 - ary[i] } # => 1, 2 or 3
(0..4).bsearch {|i| 300 - ary[i] } # => nil
(0..4).bsearch {|i| 50 - ary[i] } # => nil
//}
上記の 2 つのモードを混在して使用しないでください(ブロックの評価結果は
常に true/fa...