るりまサーチ

最速Rubyリファレンスマニュアル検索!
49件ヒット [1-49件を表示] (0.110秒)

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

クラス

キーワード

検索結果

Thread.pass -> nil (26227.0)

他のスレッドに実行権を譲ります。実行中のスレッドの状態を変えずに、 他の実行可能状態のスレッドに制御を移します。

...権を譲ります。実行中のスレッドの状態を変えずに、
他の実行可能状態のスレッドに制御を移します。

Thread.new do
(1..3).each{|i|
p i
Thread.pass
}
exit
end

loop do
Thread.pass
p :main
end

#=>
1
:main
2
:main
3
:main...

Thread.pending_interrupt?(error = nil) -> bool (20208.0)

非同期割り込みのキューが空かどうかを返します。

...Thread.handle_interrupt は非同期割り込みの発生を延期させるのに使
用しますが、本メソッドは任意の非同期割り込みが存在するかどうかを確認す
るのに使用します。

本メソッドが true を返した場合、Thread.handle_interrupt で例外...
...だちに発生させる。

def Thread.kick_interrupt_immediately
Thread.handle_interrupt(Object => :immediate) {
Thread.pass
}
end

=== 使い方

th = Thread.new{
Thread.handle_interrupt(RuntimeError => :on_blocking){
while true
...
# ここまでで...
...
i
f Thread.pending_interrupt?
Thread.handle_interrupt(Object => :immediate){}
end
...
end
}
}
...
th.raise # スレッド停止。

この例は以下のように記述する事もできます。

flag = true
th = Thread.new{
Thread.handle_in...

Object#initialize(*args, &block) -> object (14126.0)

ユーザ定義クラスのオブジェクト初期化メソッド。

...しません。

i
nitialize には
Class#new に与えられた引数がそのまま渡されます。

サブクラスではこのメソッドを必要に応じて再定義されること
が期待されています。

i
nitialize という名前のメソッドは自動的に private に設定さ...
...

//emlist[][ruby]{
class Foo
def initialize name
puts "initialize Foo"
@name = name
end
end

class Bar < Foo
def initialize name, pass
puts "initialize Bar"
super name
@pass = pass
end
end

i
t = Bar.new('myname','0500')
p it
#=> initialize Bar
# initialize Foo
# #...
...<Bar:0x2b68f08 @name="myname", @pass="0500">
//}

@see Class#new...

Thread.handle_interrupt(hash) { ... } -> object (14108.0)

スレッドの割り込みのタイミングを引数で指定した内容に変更してブロックを 実行します。

...数で指定した内容に変更してブロックを
実行します。

「割り込み」とは、非同期イベントや Thread#raise や
Thread#kill、Signal.#trap(未サポート)、メインスレッドの終了
(メインスレッドが終了すると、他のスレッドも終了されま...
...
Symbol が値の Hash を指定します。
値の内容は以下のいずれかです。

: :immediate

すぐに割り込みます。

: :on_blocking

ブロッキング処理(後述)の間は割り込みが発生します。

: :never

まったく割り込みま...
...れた非同期割り込みは再度有効にされるまで延期されます。本
メソッドは sigprocmask(3) に似ています。

@return ブロックの評価結果を返します。

@raise ArgumentError ブロックを指定しなかった場合に発生します。

=== 注意

非同...

Module#ruby2_keywords(method_name, ...) -> nil (8108.0)

For the given method names, marks the method as passing keywords through a normal argument splat. This should only be called on methods that accept an argument splat (`*args`) but not explicit keywords or a keyword splat. It marks the method such that if the method is called with keyword arguments, the final hash argument is marked with a special flag such that if it is the final element of a normal argument splat to another method call, and that method call does not include explicit keywords or a keyword splat, the final element is interpreted as keywords. In other words, keywords will be passed through the method to other methods.

...given method names, marks the method as passing keywords through
a normal argument splat. This should only be called on methods that
accept an argument splat (`*args`) but not explicit keywords or a
keyword splat. It marks the method such that if the method is called
with keyword arguments, the fi...
...sh argument is marked with a special
flag such that if it is the final element of a normal argument splat to
another method call, and that method call does not include explicit
keywords or a keyword splat, the final element is interpreted as
keywords. In other words, keywords will be passed through...
...ethods.

This should only be used for methods that delegate keywords to another
method, and only for backwards compatibility with Ruby versions before
2.7.

This method will probably be removed at some point, as it exists only
for backwards compatibility. As it does not exist in Ruby versions
before...

絞り込み条件を変える