るりまサーチ

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

別のキーワード

  1. openssl p
  2. openssl p=
  3. fileutils mkdir_p
  4. dh p
  5. rsa p

モジュール

オブジェクト

キーワード

検索結果

<< 1 2 3 ... > >>

Encoding::InvalidByteSequenceError#incomplete_input? -> bool (24326.0)

エラー発生時に入力文字列が不足している場合に真を返します。

...す。

//emlist[例][ruby]{
ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1")

begin
ec.convert("abc\xA1z")
rescue Encoding::InvalidByteSequenceError
p
$!
#=> #<Encoding::InvalidByteSequenceError: "\xA1" followed by "z" on EUC-JP>
p
$!.incomplete_input? #=> false
end

begin
ec.conve...
...rt("abc\xA1")
ec.finish
rescue Encoding::InvalidByteSequenceError
p
$! #=> #<Encoding::InvalidByteSequenceError: incomplete "\xA1" on EUC-JP>
p
$!.incomplete_input? #=> true
end
//}...

Process::PRIO_PROCESS -> Integer (21302.0)

対象とするプライオリティがプロセスプライオリティであることを表す定数です。

...対象とするプライオリティがプロセスプライオリティであることを表す定数です。

P
rocess.#getpriority または Process.#setpriority で使われます。...

Object::TOPLEVEL_BINDING -> Binding (18502.0)

トップレベルでの Binding オブジェクト。

...トップレベルでの Binding オブジェクト。

詳細は Binding を参照してください。...

Exception.exception(error_message = nil) -> Exception (18426.0)

例外オブジェクトを生成して返します。

...@param error_message エラーメッセージを表す文字列を指定します。このメッセージは
属性 Exception#message の値になり、デフォルトの例外ハンドラで表示されます。

//emlist[例][ruby]{
e = Exception.new("some message")
p
e...
...# => #<Exception: some message>
p
e.message # => "some message"
//}

//emlist[例][ruby]{
e = Exception.exception("some message")
p
e # => #<Exception: some message>
p
e.message # => "some message"
//}...

TracePoint#binding -> Binding (18408.0)

発生したイベントによって生成された Binding オブジェクトを返します。

...発生したイベントによって生成された Binding オブジェクトを返します。


//emlist[例][ruby]{
def foo(ret)
ret
end
trace = TracePoint.new(:call) do |tp|
p
tp.binding.local_variables # => [:ret]
end
trace.enable
foo 1
//}...

絞り込み条件を変える

TracePoint#binding -> Binding | nil (18408.0)

発生したイベントによって生成された Binding オブジェクトを返します。

...れた Binding オブジェクトを返します。

C で記述されたメソッドは binding を生成しないため、
:c_call および :c_return イベントに対しては nil を返すことに注意してください。

//emlist[例][ruby]{
def foo(ret)
ret
end
trace = TracePoint.new(:...
...call) do |tp|
p
tp.binding.local_variables # => [:ret]
end
trace.enable
foo 1
//}...

Exception#exception(error_message) -> Exception (18402.0)

引数を指定しない場合は self を返します。引数を指定した場合 自身のコピー を生成し Exception#message 属性を error_message にして返します。

...Exception#message 属性を error_message にして返します。

Kernel.#raise は、実質的に、例外オブジェクトの exception
メソッドの呼び出しです。

@param error_message エラーメッセージを表す文字列を指定します。

//emlist[例][ruby]{
begin
# ......
...# 何か処理
rescue => e
raise e.exception("an error occurs during hogehoge process") # 詳しいエラーメッセージ
end
//}...

Array#repeated_permutation(n) -> Enumerator (18303.0)

サイズ n の重複順列をすべて生成し,それを引数としてブロックを実行します。

...オブジェクトを返します。

@param n 生成する配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。

@raise TypeError 引数に整数以外の(暗黙...
...mlist[例][ruby]{
a = [1, 2]
a.repeated_permutation(1).to_a #=> [[1], [2]]
a.repeated_permutation(2).to_a #=> [[1,1],[1,2],[2,1],[2,2]]
a.repeated_permutation(3).to_a #=> [[1,1,1],[1,1,2],[1,2,1],[1,2,2],
# [2,1,1],[2,1,2],[2,2,1],[2,2,2]]
a.repeated_permutation...
...(0).to_a #=> [[]] # one permutation of length 0
//}

ブロックが与えられた場合、作成した配列の各要素を引数としてブロックを実
行して self を返します。

//emlist[例][ruby]{
a = [1, 2]
result = []
a.repeated_permutation(3) {|e| result << e} # => [1,2]
result...

Array#repeated_permutation(n) { |p| ... } -> self (18303.0)

サイズ n の重複順列をすべて生成し,それを引数としてブロックを実行します。

...オブジェクトを返します。

@param n 生成する配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。

@raise TypeError 引数に整数以外の(暗黙...
...mlist[例][ruby]{
a = [1, 2]
a.repeated_permutation(1).to_a #=> [[1], [2]]
a.repeated_permutation(2).to_a #=> [[1,1],[1,2],[2,1],[2,2]]
a.repeated_permutation(3).to_a #=> [[1,1,1],[1,1,2],[1,2,1],[1,2,2],
# [2,1,1],[2,1,2],[2,2,1],[2,2,2]]
a.repeated_permutation...
...(0).to_a #=> [[]] # one permutation of length 0
//}

ブロックが与えられた場合、作成した配列の各要素を引数としてブロックを実
行して self を返します。

//emlist[例][ruby]{
a = [1, 2]
result = []
a.repeated_permutation(3) {|e| result << e} # => [1,2]
result...

Thread#pending_interrupt?(error = nil) -> bool (18302.0)

self の非同期例外のキューが空かどうかを返します。

...self の非同期例外のキューが空かどうかを返します。

@param error 対象の例外クラスを指定します。


@see Thread.pending_interrupt?...

絞り込み条件を変える

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

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

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

本メソッドが true を返した場合、Thread.handle_interrupt で例外...
...@param error 対象の例外クラスを指定します。省略した場合は全ての例外を対
象に確認を行います。

例: 延期させられていた例外をただちに発生させる。

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

=== 使い方

th = Thread.new{
Thread.handle_interrupt(RuntimeError => :on_blocking){
while true
...
# ここまでで割り込みが発生しても安全な状態になった。
i
f Thread.pending_interrupt?
Thr...
<< 1 2 3 ... > >>