るりまサーチ

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

別のキーワード

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

ライブラリ

キーワード

検索結果

<< 1 2 3 > >>

MatchData#begin(n) -> Integer | nil (32138.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 (29102.0)

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

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

@see Enumerator::ArithmeticSequence#end...

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

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

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

@see Enumerator::ArithmeticSequence#end...

Array#at(nth) -> object | nil (23107.0)

nth 番目の要素を返します。nth 番目の要素が存在しない時には nil を返します。

nth 番目の要素を返します。nth 番目の要素が存在しない時には nil を返します。

@param nth インデックスを整数で指定します。
先頭の要素が 0 番目になります。nth の値が負の時には末尾から
のインデックスと見倣します。末尾の要素が -1 番目になります。
整数以外のオブジェクトを指定した場合は to_int メソッドによる
暗黙の型変換を試みます。

@raise TypeError 引数に整数以外の(暗黙の型変換が行えない)オブジェクトを
指定...

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

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

...が、
Thread::Backtrace::Location の配列を返す点が異なります。

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

//emlist[例: test.rb][ruby]{
require "date"
def check_long_month(month)
return if Date.new(2000, 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_exception'", "test.rb:1...

絞り込み条件を変える

SystemExit#status -> Integer (14113.0)

例外オブジェクトに保存された終了ステータスを返します。

...します。

終了ステータスは Kernel.#exit や SystemExit.new などで設定されます。

例:

begin

exit 1
rescue SystemExit => err
p err.status # => 1
end

begin

raise SystemExit.new(1, "dummy exit")
rescue SystemExit => err
p err.status # => 1
end...

LoadError#path -> String | nil (14107.0)

Kernel.#require や Kernel.#load に失敗したパスを返します。

...Kernel.#require や Kernel.#load に失敗したパスを返します。

begin

require 'this/file/does/not/exist'
rescue LoadError => e
e.path # => 'this/file/does/not/exist'
end

パスが定まらない場合は nil を返します。...

MatchData#offset(n) -> [Integer, Integer] | [nil, nil] (14015.0)

n 番目の部分文字列のオフセットの配列 [start, end] を返 します。

...self.begin(n), self.end(n) ]
//}

と同じです。n番目の部分文字列がマッチしていなければ
[nil, nil] を返します。

@param n 部分文字列を指定する数値

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

@see MatchData#begin, MatchData#en...
...d, MatchData#offset...

MatchData#offset(name) -> [Integer, Integer] | [nil, nil] (14015.0)

name という名前付きグループに対応する部分文字列のオフセットの配列 [start, end] を返 します。

...う名前付きグループに対応する部分文字列のオフセットの配列 [start, end] を返
します。

//emlist[例][ruby]{
[ self.begin(name), self.end(name) ]
//}

と同じです。nameの名前付きグループにマッチした部分文字列がなければ
[nil, nil] を返し...
...('year') # => [0, 4]
p $~.offset(:year) # => [0, 4]
p $~.offset('month') # => [5, 6]
p $~.offset(:month) # => [5, 6]
p $~.offset('day') # => [nil, nil]
p $~.offset('century') # => `offset': undefined group name reference: century (IndexError)
//}

@see MatchData#begin, MatchData#end...
...0, 4]
p $~.offset(:year) # => [0, 4]
p $~.offset('month') # => [5, 6]
p $~.offset(:month) # => [5, 6]
p $~.offset('day') # => [nil, nil]
p $~.offset('century') # => `offset': undefined group name reference: century (IndexError)
//}

@see MatchData#begin, MatchData#end, MatchData#offset...

MatchData#end(n) -> Integer | nil (14007.0)

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

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

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

@see MatchData#begin...

絞り込み条件を変える

Thread#terminate -> self (11107.0)

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

...セスを Kernel.#exit(0)
により終了します。

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

th1 = Thread.new do
begin

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

sleep 0.1
th1.kill

#=> "this will be displayed"

@see Kernel.#ex...
<< 1 2 3 > >>