るりまサーチ

最速Rubyリファレンスマニュアル検索!
266件ヒット [1-100件を表示] (0.081秒)
トップページ > クエリ:IO[x] > クエリ:p[x] > クエリ:call[x]

別のキーワード

  1. io popen
  2. io pipe
  3. io each
  4. io each_line
  5. io readlines

検索結果

<< 1 2 3 > >>

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

call
er_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

call
er_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 オブジェクト
p
roc を指定します。
p
roc は、次のものを想定しています。
(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|
p
uts 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>'"
//}...
<< 1 2 3 > >>