別のキーワード
種類
- インスタンスメソッド (98)
- 文書 (82)
- 特異メソッド (49)
- モジュール関数 (26)
- クラス (11)
ライブラリ
- ビルトイン (83)
- continuation (11)
- fiddle (22)
-
minitest
/ unit (9) - open-uri (4)
- openssl (33)
- readline (11)
-
webrick
/ httpserver (11)
クラス
- Exception (7)
-
Fiddle
:: Function (22) -
OpenSSL
:: SSL :: SSLContext (33) - Thread (32)
-
Thread
:: Backtrace :: Location (22) -
WEBrick
:: HTTPServer (11)
モジュール
- Kernel (26)
-
MiniTest
:: Assertions (9) - Readline (11)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) - Continuation (11)
-
NEWS for Ruby 2
. 5 . 0 (7) -
NEWS for Ruby 2
. 7 . 0 (5) -
NEWS for Ruby 3
. 0 . 0 (4) -
absolute
_ path (11) -
assert
_ empty (1) -
assert
_ equal (1) -
assert
_ in _ delta (1) -
assert
_ in _ epsilon (1) -
assert
_ match (1) -
assert
_ operator (1) -
assert
_ respond _ to (1) -
assert
_ same (1) -
caller
_ locations (22) -
completion
_ proc= (11) - inspect (11)
- new (22)
- open (4)
-
report
_ on _ exception (16) -
report
_ on _ exception= (16) -
ruby 1
. 6 feature (11) -
ruby 1
. 8 . 4 feature (11) -
ruby 1
. 9 feature (11) -
session
_ get _ cb= (11) -
session
_ new _ cb= (11) -
session
_ remove _ cb= (11) - skip (1)
- セキュリティモデル (11)
- 制御構造 (11)
検索結果
先頭5件
-
Fiddle
:: Function # call(*args) -> Integer|DL :: CPtr|nil (21207.0) -
関数を呼び出します。
...関数を呼び出します。
Fiddle::Function.new で指定した引数と返り値の型に基いて
Ruby のオブジェクトを適切に C のデータに変換して C の関数を呼び出し、
その返り値を Ruby のオブジェクトに変換して返します。
引数の変換は......す
Fiddle::Pointer は保持している C ポインタに変換されます。
文字列であればその先頭ポインタになります。
IO オブジェクトであれば FILE* が渡されます。
整数であればそれがアドレスとみなされます。
to_ptr を持って......いるならば、それを呼びだし Fiddle::Pointer に
変換したものを用います。
to_i を持っているならば、それを呼びだし結果の整数を
アドレスと見なします
: (unsigned) char/short/int/long/long long
Ruby の整数を C の整数に変換し... -
Kernel
. # caller _ locations(range) -> [Thread :: Backtrace :: Location] | nil (12318.0) -
現在のフレームを Thread::Backtrace::Location の配列で返します。引 数で指定した値が範囲外の場合は nil を返します。
...Thread::Backtrace::Location の配列で返します。引
数で指定した値が範囲外の場合は nil を返します。
@param start 開始フレームの位置を数値で指定します。
@param length 取得するフレームの個数を指定します。
@param range 取得した......{
def test1(start, length)
locations = caller_locations(start, length)
p locations
p locations.map(&:lineno)
p locations.map(&:path)
end
def test2(start, length)
test1(start, length)
end
def test3(start, length)
test2(start, length)
end
caller_locations # => []
test3(1, nil)
# => ["/U......(1, 2)
# => ["/Users/user/test.rb:9:in `test2'", "/Users/user/test.rb:13:in `test3'"]
# => [9, 13]
# => ["/Users/user/test.rb", "/Users/user/test.rb"]
test3(2, 1)
# => ["/Users/user/test.rb:13:in `test3'"]
# => [13]
# => ["/Users/user/test.rb"]
//}
@see Thread::Backtrace::Location, Kernel.#caller... -
Kernel
. # caller _ locations(start = 1 , length = nil) -> [Thread :: Backtrace :: Location] | nil (12318.0) -
現在のフレームを Thread::Backtrace::Location の配列で返します。引 数で指定した値が範囲外の場合は nil を返します。
...Thread::Backtrace::Location の配列で返します。引
数で指定した値が範囲外の場合は nil を返します。
@param start 開始フレームの位置を数値で指定します。
@param length 取得するフレームの個数を指定します。
@param range 取得した......{
def test1(start, length)
locations = caller_locations(start, length)
p locations
p locations.map(&:lineno)
p locations.map(&:path)
end
def test2(start, length)
test1(start, length)
end
def test3(start, length)
test2(start, length)
end
caller_locations # => []
test3(1, nil)
# => ["/U......(1, 2)
# => ["/Users/user/test.rb:9:in `test2'", "/Users/user/test.rb:13:in `test3'"]
# => [9, 13]
# => ["/Users/user/test.rb", "/Users/user/test.rb"]
test3(2, 1)
# => ["/Users/user/test.rb:13:in `test3'"]
# => [13]
# => ["/Users/user/test.rb"]
//}
@see Thread::Backtrace::Location, Kernel.#caller... -
Readline
. completion _ proc=(proc) (12232.0) -
ユーザからの入力を補完する時の候補を取得する Proc オブジェクト proc を指定します。 proc は、次のものを想定しています。 (1) callメソッドを持つ。callメソッドを持たない場合、例外 ArgumentError を発生します。 (2) 引数にユーザからの入力文字列を取る。 (3) 候補の文字列の配列を返す。
...ユーザからの入力を補完する時の候補を取得する Proc オブジェクト
proc を指定します。
proc は、次のものを想定しています。
(1) callメソッドを持つ。callメソッドを持たない場合、例外 ArgumentError を発生します。
(2) 引数......の配列を返す。
「/var/lib /v」の後で補完を行うと、
デフォルトでは proc の引数に「/v」が渡されます。
このように、ユーザが入力した文字列を
Readline.completer_word_break_characters に含まれる文字で区切ったものを単語とすると......する Proc オブジェクトを指定します。
nil を指定した場合はデフォルトの動作になります。
例: foo、foobar、foobazを補完する。
require 'readline'
WORDS = %w(foo foobar foobaz)
Readline.completion_proc = proc {|word|
WORDS.grep(/\A#... -
Thread
# report _ on _ exception -> bool (12206.0) -
真の場合、そのスレッドが例外によって終了した時に、その内容を $stderr に報告します。
...hread.report_on_exception です。
@param newstate スレッド実行中に例外発生した場合、その内容を報告するかどうかを true か false で指定します。
//emlist[例][ruby]{
a = Thread.new{ Thread.stop; raise }
a.report_on_exception = true
a.report_on_exception # =>......b):1 run> terminated with exception (report_on_exception is true):
# Traceback (most recent call last):
# (irb):1:in `block in irb_binding': unhandled exception
# #<Thread:0x00007fc3f48c7908@(irb):1 dead>
b = Thread.new{ Thread.stop; raise }
b.report_on_exception = false
b.run # => #<Thre......ad:0x00007fc3f48aefc0@(irb):4 dead>
//}
@see Thread.report_on_exception... -
Thread
# report _ on _ exception=(newstate) (12206.0) -
真の場合、そのスレッドが例外によって終了した時に、その内容を $stderr に報告します。
...hread.report_on_exception です。
@param newstate スレッド実行中に例外発生した場合、その内容を報告するかどうかを true か false で指定します。
//emlist[例][ruby]{
a = Thread.new{ Thread.stop; raise }
a.report_on_exception = true
a.report_on_exception # =>......b):1 run> terminated with exception (report_on_exception is true):
# Traceback (most recent call last):
# (irb):1:in `block in irb_binding': unhandled exception
# #<Thread:0x00007fc3f48c7908@(irb):1 dead>
b = Thread.new{ Thread.stop; raise }
b.report_on_exception = false
b.run # => #<Thre......ad:0x00007fc3f48aefc0@(irb):4 dead>
//}
@see Thread.report_on_exception... -
Thread
. report _ on _ exception -> bool (12206.0) -
真の時は、いずれかのスレッドが例外によって終了した時に、その内容を $stderr に報告します。
...ad.new { 1.times { raise } }
は $stderr に以下のように出力します:
#<Thread:...> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
2: from -e:1:in `block in <main>'
1: from -e:1:in `times'
これによってスレッド......d#join や Thread#value でそのスレッドの終了を待つことが保証できるなら、
スレッド開始時に Thread.current.report_on_exception = false でレポートを無効化しても
安全です。しかし、この場合、例外をハンドルするのが遅れたり、......を待つことができなかったりするかもしれません。
スレッドごとに設定する方法は Thread#report_on_exception= を参照してください。
@param newstate スレッド実行中に例外発生した場合、その内容を報告するかどうかを true か false... -
Thread
. report _ on _ exception=(newstate) (12206.0) -
真の時は、いずれかのスレッドが例外によって終了した時に、その内容を $stderr に報告します。
...ad.new { 1.times { raise } }
は $stderr に以下のように出力します:
#<Thread:...> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
2: from -e:1:in `block in <main>'
1: from -e:1:in `times'
これによってスレッド......d#join や Thread#value でそのスレッドの終了を待つことが保証できるなら、
スレッド開始時に Thread.current.report_on_exception = false でレポートを無効化しても
安全です。しかし、この場合、例外をハンドルするのが遅れたり、......を待つことができなかったりするかもしれません。
スレッドごとに設定する方法は Thread#report_on_exception= を参照してください。
@param newstate スレッド実行中に例外発生した場合、その内容を報告するかどうかを true か false... -
MiniTest
:: Assertions # assert _ operator(operand1 , operator , operand2 , message = nil) -> true (9406.0) -
与えられたオブジェクトから作成する式を評価した結果が真を返す場合、検査にパスしたことになります。
...検査にパスしたことになります。
@param operand1 任意のオブジェクトを指定します。
@param operator 真偽値を返すメソッドを指定します。
@param operand2 任意のオブジェクトを指定します。
@param message 検査に失敗した場合に表示......するメッセージを指定します。
文字列か Proc を指定します。Proc である場合は Proc#call した
結果を使用します。
@raise MiniTest::Assertion 与えられたオブジェクトから作成する式を評価した結果が真でない......場合に発生します。
例:
# 以下の二つは同じ
assert_operator('aaa', :==, 'aaa', 'message')
assert('aaa'.__send__(:==, 'aaa'), 'message')... -
MiniTest
:: Assertions # assert _ in _ epsilon(actual , expected , epsilon = 0 . 001 , message = nil) -> true (9206.0) -
与えられた期待値と実際の値の相対誤差が許容範囲内である場合、検査にパスしたことになります。
...合、検査をパスします。
[expected, actual].min * epsilon >= (extected - actual).abs
@param expected 期待値を指定します。
@param actual 実際の値を指定します。
@param epsilon 許容する相対誤差を指定します。
@param message 検査に失敗した場合......に表示するメッセージを指定します。
文字列か Proc を指定します。Proc である場合は Proc#call した
結果を使用します。
@raise MiniTest::Assertion 検査に失敗した場合に発生します。... -
MiniTest
:: Assertions # skip(message = nil , backtrace = caller) (9200.0) -
このメソッドを呼び出したテストメソッドをスキップします。
...スキップします。
@param message メッセージを指定します。
@param backtrace 例外発生時のスタックトレースで、Kernel.#caller の戻り値と同じ
形式で指定しなければいけません。
@raise MiniTest::Skip 必ず発生します。
@see... -
Thread
:: Backtrace :: Location # absolute _ path -> String (9112.0) -
self が表すフレームの絶対パスを返します。
...][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end
Foo.new(0..2).locations.map do |call|
puts call.absolute_path
end
# => /path/to/foo.rb
# /path/to/foo.rb
# /path/to/foo.rb
//}
@see Thread::Backtrace::Location#path... -
Thread
:: Backtrace :: Location # inspect -> String (9112.0) -
Thread::Backtrace::Location#to_s の結果を人間が読みやすいような文 字列に変換したオブジェクトを返します。
...tion#to_s の結果を人間が読みやすいような文
字列に変換したオブジェクトを返します。
//emlist[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end
Foo.new(0..2).locations.map do |call|
p......uts call.inspect
end
# => "path/to/foo.rb:5:in `initialize'"
# "path/to/foo.rb:9:in `new'"
# "path/to/foo.rb:9:in `<main>'"
//}...