るりまサーチ

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

別のキーワード

  1. openssl t61string
  2. asn1 t61string
  3. matrix t
  4. t61string new
  5. fiddle type_size_t

ライブラリ

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

MatchData#begin(n) -> Integer | nil (21238.0)

n 番目の部分文字列先頭のオフセットを返します。

...範囲外の n を指定した場合に発生します。

//emlist[例][ruby]{
/(foo)(bar)(BAZ)?/ =~ "foobarbaz"
p $~.begin(0) # => 0
p $~.begin(1) # => 0
p $~.begin(2) # => 3
p $~.begin(3) # => nil
p $~.begin(4) # => `begin': index 4 out of matches (IndexError)
//}

@see MatchData#end...

Enumerator::ArithmeticSequence#begin -> Numeric (21102.0)

初項 (始端) を返します。

...初項 (始端) を返します。

@see Enumerator::ArithmeticSequence#end...

Enumerator::ArithmeticSequence#begin -> Numeric | nil (21102.0)

初項 (始端) を返します。

...初項 (始端) を返します。

@see Enumerator::ArithmeticSequence#end...

Range#begin -> object (18236.0)

始端の要素を返します。 始端を持たない範囲オブジェクトの場合、begin はnilを返しますが, first は例外 RangeError が発生します。

...場合、begin はnilを返しますが, first は例外 RangeError が発生します。

//emlist[例][ruby]{
# 始端を持つ場合
p (1..5).begin # => 1
p (1..0).begin # => 1
p (1..5).first # => 1
p (1..0).first # => 1

# 始端を持たない場合
p (..5).begin #=> nil
p (..5).first #=> Range...

Exception#backtrace_locations -> [Thread::Backtrace::Location] (9207.0)

バックトレース情報を返します。Exception#backtraceに似ていますが、 Thread::Backtrace::Location の配列を返す点が異なります。

...ption#backtraceに似ていますが、
T
hread::Backtrace::Location の配列を返す点が異なります。

現状では Exception#set_backtrace によって戻り値が変化する事はあり
ません。

//emlist[例: test.rb][ruby]{
require "date"
def check_long_month(month)
return if Dat...
...month, -1).day == 31
raise "#{month} is not long month"
end

def get_exception
return begin
yield
rescue => e
e
end
end

e = get_exception { check_long_month(2) }
p e.backtrace_locations
# => ["test.rb:4:in `check_long_month'", "test.rb:15:in `block in <main>'", "test.rb:9:in `get_ex...
...ception'", "test.rb:15:in `<main>'"]
//}

@see Exception#backtrace...

絞り込み条件を変える

Exception#exception(error_message) -> Exception (9207.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
//}...

Thread#terminate -> self (9207.0)

スレッドの実行を終了させます。終了時に ensure 節が実行されます。

...す。

ただし、スレッドは終了処理中(aborting)にはなりますが、
直ちに終了するとは限りません。すでに終了している場合は何もしません。このメソッドにより
終了したスレッドの Thread#value の返り値は不定です。
自身がメ...
...exit(0)
により終了します。

Kernel.#exit と違い例外 SystemExit を発生しません。

t
h1 = Thread.new do
begin

sleep 10
ensure
p "this will be displayed"
end
end

sleep 0.1
t
h1.kill

#=> "this will be displayed"

@see Kernel.#exit, Kernel.#exit!...

Encoding::InvalidByteSequenceError#incomplete_input? -> bool (9113.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.convert("abc\...
...xA1")
ec.finish
rescue Encoding::InvalidByteSequenceError
p $! #=> #<Encoding::InvalidByteSequenceError: incomplete "\xA1" on EUC-JP>
p $!.incomplete_input? #=> true
end
//}...

Encoding::InvalidByteSequenceError#error_bytes -> String (9107.0)

エラー発生時に捨てられたバイト列を返します。

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

ec.convert("abc\xA1\xFFdef")
rescue Encoding::InvalidByteSequenceError
p $!
#=> #<Encoding::InvalidByteSequenceError: "\xA1" followed by "\xFF" on EUC-JP>
puts $!.error_bytes.dump #=> "\xA1"
puts $!.re...
...adagain_bytes.dump #=> "\xFF"
end
//}

@see Encoding::InvalidByteSequenceError#readagain_bytes...

Exception#exception -> self (9107.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
//}...

絞り込み条件を変える

<< 1 2 3 ... > >>