308件ヒット
[1-100件を表示]
(0.128秒)
ライブラリ
- ビルトイン (267)
-
minitest
/ unit (17) -
webrick
/ httpserver (24)
クラス
- BasicObject (24)
- Exception (8)
- Module (12)
- Object (24)
- Proc (48)
- SystemCallError (12)
- Thread (18)
- TracePoint (67)
- UnboundMethod (6)
-
WEBrick
:: HTTPServer (24)
モジュール
- Enumerable (48)
-
MiniTest
:: Assertions (17)
キーワード
- === (12)
- [] (12)
- assert (1)
-
assert
_ block (1) -
assert
_ empty (1) -
assert
_ equal (1) -
assert
_ in _ delta (1) -
assert
_ in _ epsilon (1) -
assert
_ includes (1) -
assert
_ instance _ of (1) -
assert
_ kind _ of (1) -
assert
_ match (1) -
assert
_ nil (1) -
assert
_ operator (1) -
assert
_ respond _ to (1) -
assert
_ same (1) -
assert
_ send (1) -
assert
_ throws (1) - bind (6)
-
callee
_ id (12) - detect (24)
- errno (12)
- event (12)
- find (24)
-
instance
_ eval (24) -
instance
_ method (12) - lineno (12)
- method (12)
-
method
_ id (12) -
mount
_ proc (24) - parameters (7)
- path (12)
-
report
_ on _ exception (9) -
report
_ on _ exception= (9) -
singleton
_ method (12) - skip (1)
- yield (12)
検索結果
先頭5件
-
Proc
# call(*arg) -> () (15108.0) -
手続きオブジェクトを実行してその結果を返します。
...when 0 then 0
when 1 then 1
else
fib.(n - 2) + fib.(n - 1)
end
}
fib.(10) # => 55
//}
@param arg 手続きオブジェクトに与える引数を指定します。
@raise LocalJumpError Procを生成したメソッドからリターンしてしまった場合に発生します。... -
TracePoint
# callee _ id -> Symbol | nil (6113.0) -
イベントが発生したメソッドの呼ばれた名前を Symbol で返します。 トップレベルであった場合は nil を返します。
...は nil を返します。
@raise RuntimeError イベントフックの外側で実行した場合に発生します。
//emlist[][ruby]{
class C
def method_name
end
alias alias_name method_name
end
trace = TracePoint.new(:call) do |tp|
p [tp.method_id, tp.callee_id] # => [:method_name, :... -
SystemCallError
# errno -> Integer | nil (3013.0) -
レシーバに対応するシステム依存のエラーコードを返します。
...した場合は nil を返します。
begin
raise Errno::ENOENT
rescue Errno::ENOENT => err
p err.errno # => 2
p Errno::ENOENT::Errno # => 2
end
begin
raise SystemCallError, 'message'
rescue SystemCallError => err
p err.errno # =>... -
MiniTest
:: Assertions # skip(message = nil , backtrace = caller) (113.0) -
このメソッドを呼び出したテストメソッドをスキップします。
...ます。
@param message メッセージを指定します。
@param backtrace 例外発生時のスタックトレースで、Kernel.#caller の戻り値と同じ
形式で指定しなければいけません。
@raise MiniTest::Skip 必ず発生します。
@see Kernel.#raise... -
BasicObject
# instance _ eval {|obj| . . . } -> object (43.0) -
オブジェクトのコンテキストで文字列 expr またはオブジェクト自身をブロックパラメータとするブロックを 評価してその結果を返します。
...some.instance_eval 'raise' # ..:10: (eval):1: (RuntimeError)
messg = 'unknown'
some.instance_eval 'raise messg','file.rb',999 # file.rb:999: unknown (RuntimeError)
//}
//emlist[例][ruby]{
class Bar < BasicObject
def call1
instance_eval("::ENV.class")
end
def call2
instance_eval("E......NV.class")
end
end
bar = Bar.new
bar.call1 # => Object
bar.call2 # raise NameError
//}
@see Module#module_eval, Kernel.#eval, BasicObject#instance_exec... -
BasicObject
# instance _ eval(expr , filename = "(eval)" , lineno = 1) -> object (43.0) -
オブジェクトのコンテキストで文字列 expr またはオブジェクト自身をブロックパラメータとするブロックを 評価してその結果を返します。
...some.instance_eval 'raise' # ..:10: (eval):1: (RuntimeError)
messg = 'unknown'
some.instance_eval 'raise messg','file.rb',999 # file.rb:999: unknown (RuntimeError)
//}
//emlist[例][ruby]{
class Bar < BasicObject
def call1
instance_eval("::ENV.class")
end
def call2
instance_eval("E......NV.class")
end
end
bar = Bar.new
bar.call1 # => Object
bar.call2 # raise NameError
//}
@see Module#module_eval, Kernel.#eval, BasicObject#instance_exec... -
TracePoint
# parameters -> [object] (31.0) -
現在のフックが属するメソッドまたはブロックのパラメータ定義を返します。 フォーマットは Method#parameters と同じです。
...同じです。
@raise RuntimeError :call、:return、:b_call、:b_return、:c_call、:c_return
イベントのためのイベントフックの外側で実行した場合に発生します。
//emlist[例][ruby]{
def foo(a, b = 2)
end
TracePoint.new(:call) do |tp|
p tp.param... -
Enumerable
# detect(ifnone = nil) -> Enumerator (19.0) -
要素に対してブロックを評価した値が真になった最初の要素を返します。
...になる要素が見つからず、ifnone が指定されているときは ifnone を call した結果を返します。
ブロックを省略した場合は Enumerator を返します。
@param ifnone call メソッドを持つオブジェクト (例えば Proc) を指定します。
//emlis......初の 3 の倍数を探す
p [1, 2, 3, 4, 5].find {|i| i % 3 == 0 } # => 3
p [2, 2, 2, 2, 2].find {|i| i % 3 == 0 } # => nil
# ifnone の使用例
ifnone = proc { raise ArgumentError, "item not found" }
p [1, 2, 3, 4, 5].find(ifnone) {|i| i % 7 == 0 }
# ArgumentError: item not found
//}... -
Enumerable
# detect(ifnone = nil) {|item| . . . } -> object (19.0) -
要素に対してブロックを評価した値が真になった最初の要素を返します。
...になる要素が見つからず、ifnone が指定されているときは ifnone を call した結果を返します。
ブロックを省略した場合は Enumerator を返します。
@param ifnone call メソッドを持つオブジェクト (例えば Proc) を指定します。
//emlis......初の 3 の倍数を探す
p [1, 2, 3, 4, 5].find {|i| i % 3 == 0 } # => 3
p [2, 2, 2, 2, 2].find {|i| i % 3 == 0 } # => nil
# ifnone の使用例
ifnone = proc { raise ArgumentError, "item not found" }
p [1, 2, 3, 4, 5].find(ifnone) {|i| i % 7 == 0 }
# ArgumentError: item not found
//}... -
Enumerable
# find(ifnone = nil) -> Enumerator (19.0) -
要素に対してブロックを評価した値が真になった最初の要素を返します。
...になる要素が見つからず、ifnone が指定されているときは ifnone を call した結果を返します。
ブロックを省略した場合は Enumerator を返します。
@param ifnone call メソッドを持つオブジェクト (例えば Proc) を指定します。
//emlis......初の 3 の倍数を探す
p [1, 2, 3, 4, 5].find {|i| i % 3 == 0 } # => 3
p [2, 2, 2, 2, 2].find {|i| i % 3 == 0 } # => nil
# ifnone の使用例
ifnone = proc { raise ArgumentError, "item not found" }
p [1, 2, 3, 4, 5].find(ifnone) {|i| i % 7 == 0 }
# ArgumentError: item not found
//}...