別のキーワード
ライブラリ
クラス
-
ARGF
. class (24) - Array (96)
- BasicObject (36)
- Binding (12)
- Dir (12)
- Enumerator (48)
- Exception (80)
- Fiber (42)
- File (36)
- FrozenError (6)
- IO (160)
-
IRB
:: ExtendCommand :: Load (12) - MatchData (104)
- Module (252)
- Mutex (4)
-
Net
:: HTTPResponse (12) - Numeric (93)
- Object (144)
- OptionParser (60)
-
Rake
:: InvocationChain (12) - Random (36)
- Range (72)
- Regexp (12)
- String (24)
- StringScanner (60)
-
Thread
:: Mutex (20) - TracePoint (105)
- UnboundMethod (12)
- WIN32OLE (12)
モジュール
- Comparable (12)
- Enumerable (60)
-
Net
:: HTTPHeader (36) -
Rake
:: TaskManager (12) - TSort (35)
キーワード
- < (12)
- <= (12)
- == (24)
- === (12)
- =~ (12)
- > (12)
- >= (12)
- [] (72)
- []= (24)
- accept (12)
- append (12)
- at (12)
- backtrace (12)
-
backtrace
_ locations (12) - begin (24)
- bind (12)
- byteend (2)
- byteoffset (6)
-
callee
_ id (12) - chunk (12)
- clamp (12)
-
class
_ variable _ get (12) - clone (12)
-
close
_ write (12) -
const
_ get (12) -
const
_ missing (12) -
define
_ method (24) - dup (12)
-
each
_ byte (24) -
enum
_ for (24) -
eval
_ script (7) - event (12)
- exception (24)
- execute (12)
- fcntl (12)
- fdatasync (12)
- feed (12)
- fetch (72)
- first (24)
-
initialize
_ copy (12) -
instance
_ eval (24) -
instance
_ method (12) -
instruction
_ sequence (7) - last (24)
- lineno (12)
-
local
_ variable _ get (12) - lstat (12)
- max (24)
-
method
_ id (12) -
method
_ missing (12) - min (24)
- next (12)
-
next
_ values (12) - offset (24)
-
ole
_ query _ interface (12) - parameters (7)
- parse (24)
- parse! (12)
- path (12)
- peek (12)
-
peek
_ values (12) - peep (12)
- pid (12)
- pointer= (12)
- pos (12)
- pos= (12)
- pread (8)
- private (48)
-
private
_ constant (12) - public (12)
-
public
_ constant (12) -
public
_ send (24) - pwrite (8)
-
raised
_ exception (12) - rand (36)
- read (12)
- readbyte (24)
- readchar (12)
- receiver (6)
- reject (12)
-
remove
_ class _ variable (12) -
remove
_ const (12) -
remove
_ instance _ variable (12) -
remove
_ method (12) -
respond
_ to? (12) - resume (12)
-
return
_ value (12) -
set
_ backtrace (12) -
singleton
_ method (12) - size (12)
- sleep (12)
- stat (12)
- step (93)
- synchronize (12)
-
synthesize
_ file _ task (12) - syswrite (12)
- tell (12)
-
to
_ enum (24) - transfer (12)
- truncate (12)
- tsort (12)
-
tsort
_ each (23) -
undef
_ method (12) - unscan (12)
- value (12)
- write (12)
検索結果
先頭5件
-
MatchData
# end(n) -> Integer | nil (21274.0) -
n 番目の部分文字列終端のオフセットを返します。
...。
@param n 部分文字列を指定する数値。
@raise 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': i......ndex 4 out of matches (IndexError)
//}
@see MatchData#begin... -
Fiber
# raise -> object (18270.0) -
selfが表すファイバーが最後に Fiber.yield を呼んだ場所で例外を発生させます。
...さない場合、RuntimeError が発生します。
message 引数を渡した場合、message 引数をメッセージとした RuntimeError
が発生します。
その他のケースでは、最初の引数は Exception か Exception
のインスタンスを返す exception メソッドを持......。
@param message 例外のメッセージとなる文字列です。
@param exception 発生させる例外です。
@param backtrace 例外発生時のスタックトレースです。文字列の配列で指定します。
//emlist[例][ruby]{
f = Fiber.new { Fiber.yield }
f.resume
f.raise "Er......ror!" # => Error! (RuntimeError)
//}
//emlist[ファイバー内のイテレーションを終了させる例][ruby]{
f = Fiber.new do
loop do
Fiber.yield(:loop)
end
:exit
end
p f.resume # => :loop
p f.raise StopIteration # => :exit
//}... -
Fiber
# raise(exception , message = nil , backtrace = nil) -> object (18270.0) -
selfが表すファイバーが最後に Fiber.yield を呼んだ場所で例外を発生させます。
...さない場合、RuntimeError が発生します。
message 引数を渡した場合、message 引数をメッセージとした RuntimeError
が発生します。
その他のケースでは、最初の引数は Exception か Exception
のインスタンスを返す exception メソッドを持......。
@param message 例外のメッセージとなる文字列です。
@param exception 発生させる例外です。
@param backtrace 例外発生時のスタックトレースです。文字列の配列で指定します。
//emlist[例][ruby]{
f = Fiber.new { Fiber.yield }
f.resume
f.raise "Er......ror!" # => Error! (RuntimeError)
//}
//emlist[ファイバー内のイテレーションを終了させる例][ruby]{
f = Fiber.new do
loop do
Fiber.yield(:loop)
end
:exit
end
p f.resume # => :loop
p f.raise StopIteration # => :exit
//}... -
Fiber
# raise(message) -> object (18270.0) -
selfが表すファイバーが最後に Fiber.yield を呼んだ場所で例外を発生させます。
...さない場合、RuntimeError が発生します。
message 引数を渡した場合、message 引数をメッセージとした RuntimeError
が発生します。
その他のケースでは、最初の引数は Exception か Exception
のインスタンスを返す exception メソッドを持......。
@param message 例外のメッセージとなる文字列です。
@param exception 発生させる例外です。
@param backtrace 例外発生時のスタックトレースです。文字列の配列で指定します。
//emlist[例][ruby]{
f = Fiber.new { Fiber.yield }
f.resume
f.raise "Er......ror!" # => Error! (RuntimeError)
//}
//emlist[ファイバー内のイテレーションを終了させる例][ruby]{
f = Fiber.new do
loop do
Fiber.yield(:loop)
end
:exit
end
p f.resume # => :loop
p f.raise StopIteration # => :exit
//}... -
Range
# end -> object (18229.0) -
終端の要素を返します。範囲オブジェクトが終端を含むかどうかは関係ありま せん。
...終端の要素を返します。範囲オブジェクトが終端を含むかどうかは関係ありま
せん。
//emlist[例][ruby]{
(10..20).last # => 20
(10...20).last # => 20
//}
@see Range#begin... -
MatchData
# byteend(n) -> Integer | nil (12397.0) -
n 番目の部分文字列終端のバイトオフセットを返します。
...イトオフセットを返します。
@param n 部分文字列を指定する数値。
@param name 名前付きキャプチャを指定する文字列またはシンボル。
@raise IndexError 範囲外の n を指定した場合に発生します。
@raise IndexError 正規表現中で定義さ......ist[例][ruby]{
/(c).*(いう).*(e.*)/ =~ 'abcあいうdef'
p $~ # => #<MatchData "cあいうdef" 1:"c" 2:"いう" 3:"ef">
p $~.byteend(0) # => 15
p $~.byteend(1) # => 3
p $~.byteend(2) # => 12
p $~.byteend(3) # => 15
p $~.byteend(4) # => index 4 out of matches (IndexError)
//}
//emlist[......シンボルを指定する例][ruby]{
/(?<key>\S+):\s*(?<value>\S+)/ =~ "name: ruby"
$~ # => #<MatchData "name: ruby" key:"name" value:"ruby">
$~.byteend(:key) # => 4
$~.byteend(:value) # => 10
$~.byteend(:foo) # => undefined group name reference: foo (IndexError)
//}... -
MatchData
# byteend(name) -> Integer | nil (12397.0) -
n 番目の部分文字列終端のバイトオフセットを返します。
...イトオフセットを返します。
@param n 部分文字列を指定する数値。
@param name 名前付きキャプチャを指定する文字列またはシンボル。
@raise IndexError 範囲外の n を指定した場合に発生します。
@raise IndexError 正規表現中で定義さ......ist[例][ruby]{
/(c).*(いう).*(e.*)/ =~ 'abcあいうdef'
p $~ # => #<MatchData "cあいうdef" 1:"c" 2:"いう" 3:"ef">
p $~.byteend(0) # => 15
p $~.byteend(1) # => 3
p $~.byteend(2) # => 12
p $~.byteend(3) # => 15
p $~.byteend(4) # => index 4 out of matches (IndexError)
//}
//emlist[......シンボルを指定する例][ruby]{
/(?<key>\S+):\s*(?<value>\S+)/ =~ "name: ruby"
$~ # => #<MatchData "name: ruby" key:"name" value:"ruby">
$~.byteend(:key) # => 4
$~.byteend(:value) # => 10
$~.byteend(:foo) # => undefined group name reference: foo (IndexError)
//}... -
TracePoint
# raised _ exception -> Exception (12349.0) -
発生した例外を返します。
...します。
@raise RuntimeError :raise イベントのためのイベントフックの外側で実行し
た場合に発生します。
//emlist[例][ruby]{
trace = TracePoint.new(:raise) do |tp|
tp.raised_exception # => #<ZeroDivisionError: divided by 0>
end
trace.enable
b......egin
0/0
rescue
end
//}... -
IRB
:: ExtendCommand :: Load # execute(file _ name , priv = nil) -> nil (12157.0) -
ファイル path を Ruby スクリプトとみなし、現在の irb インタプリタ上で実 行します。
...ファイル path を Ruby スクリプトとみなし、現在の irb インタプリタ上で実
行します。
Kernel.#load と異なり、path の内容を irb で一行ずつタイプしたかの
ように、irb 上で一行ずつ評価されます。
@param file_name ファイル名を文......字列で指定します。
@param priv 真を指定した場合は実行は内部的に生成される無名モジュール上
で行われ、グローバルな名前空間を汚染しません。
@raise LoadError 読み込みに失敗した場合に発生します。... -
TracePoint
# instruction _ sequence -> RubyVM :: InstructionSequence (9437.0) -
script_compiledイベント発生時にコンパイルされた RubyVM::InstructionSequenceインスタンスを返します。
...pt_compiledイベント発生時にコンパイルされた
RubyVM::InstructionSequenceインスタンスを返します。
//emlist[例][ruby]{
TracePoint.new(:script_compiled) do |tp|
p tp.instruction_sequence # => <RubyVM::InstructionSequence:block in <main>@(eval):1>
end.enable do
eval("put......s 'hello'")
end
//}
@raise RuntimeError :script_compiled イベントのための
イベントフックの外側で実行した場合に発生します。... -
Object
# public _ send(name , *args) -> object (9267.0) -
オブジェクトの public メソッド name を args を引数にして呼び出し、メソッ ドの実行結果を返します。
...//emlist[][ruby]{
1.public_send(:+, 2) # => 3
//}
@param name 文字列かSymbol で指定するメソッド名です。
@param args 呼び出すメソッドに渡す引数です。
@raise ArgumentError name を指定しなかった場合に発生します。
@raise NoMethodError protected メ......ソッドや private メソッドに対して実行
した場合に発生します。
//emlist[][ruby]{
1.public_send(:puts, "hello") # => NoMethodError
//}
@see BasicObject#__send__, Object#send... -
Object
# public _ send(name , *args) { . . . . } -> object (9267.0) -
オブジェクトの public メソッド name を args を引数にして呼び出し、メソッ ドの実行結果を返します。
...//emlist[][ruby]{
1.public_send(:+, 2) # => 3
//}
@param name 文字列かSymbol で指定するメソッド名です。
@param args 呼び出すメソッドに渡す引数です。
@raise ArgumentError name を指定しなかった場合に発生します。
@raise NoMethodError protected メ......ソッドや private メソッドに対して実行
した場合に発生します。
//emlist[][ruby]{
1.public_send(:puts, "hello") # => NoMethodError
//}
@see BasicObject#__send__, Object#send... -
Exception
# backtrace _ locations -> [Thread :: Backtrace :: Location] (9243.0) -
バックトレース情報を返します。Exception#backtraceに似ていますが、 Thread::Backtrace::Location の配列を返す点が異なります。
...ption#backtraceに似ていますが、
Thread::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...