クラス
- Proc (18)
- SystemCallError (44)
- Thread (16)
- TracePoint (22)
モジュール
キーワード
- === (11)
- new (62)
-
parse
_ file (8) -
report
_ on _ exception (8) -
report
_ on _ exception= (8) - trace (11)
検索結果
先頭5件
-
SystemCallError
. new(errno) -> SystemCallError (3103.0) -
整数 errno に対応する Errno::EXXX オブジェクトを生成して返します。
...は SystemCallError の直接のインスタンスではなく、サブクラスのインスタンスです。
それらのサブクラスは Errno モジュール内に定義されています。
対応するサブクラスが存在しないコードを与えた場合には、 SystemCallError の......ときに発生します。
例:
p SystemCallError.new("message", 2)
# => #<Errno::ENOENT: No such file or directory - message>
p SystemCallError.new(2)
# => #<Errno::ENOENT: No such file or directory>
p SystemCallError.new(256)
# => #<SystemCallError: Unknown error 256>... -
SystemCallError
. new(error _ message) -> SystemCallError (3103.0) -
SystemCallError オブジェクトを生成して返します。
...SystemCallError オブジェクトを生成して返します。
@param error_message エラーメッセージを表す文字列
例:
p SystemCallError.new("message")
# => #<SystemCallError: unknown error - message>... -
SystemCallError
. new(error _ message , errno) -> SystemCallError (3103.0) -
整数 errno に対応する Errno::EXXX オブジェクトを生成して返します。
...は SystemCallError の直接のインスタンスではなく、サブクラスのインスタンスです。
それらのサブクラスは Errno モジュール内に定義されています。
対応するサブクラスが存在しないコードを与えた場合には、 SystemCallError の......ときに発生します。
例:
p SystemCallError.new("message", 2)
# => #<Errno::ENOENT: No such file or directory - message>
p SystemCallError.new(2)
# => #<Errno::ENOENT: No such file or directory>
p SystemCallError.new(256)
# => #<SystemCallError: Unknown error 256>... -
SystemCallError
. ===(other) -> bool (3003.0) -
other が SystemCallError のサブクラスのインスタンスで、 かつ、other.errno の値が self::Errno と同じ場合に真を返します。そうでない場合は偽を返します。
...other が SystemCallError のサブクラスのインスタンスで、
かつ、other.errno の値が self::Errno と同じ場合に真を返します。そうでない場合は偽を返します。
従って、特に other が self.kind_of?(other) である場合には Module#=== と同様に真... -
TracePoint
. new(*events) {|obj| . . . } -> TracePoint (33.0) -
新しい TracePoint オブジェクトを作成して返します。トレースを有効 にするには TracePoint#enable を実行してください。
...合][ruby]{
trace = TracePoint.new(:call) do |tp|
p [tp.lineno, tp.defined_class, tp.method_id, tp.event]
end
# => #<TracePoint:0x007f17372cdb20>
trace.enable
# => false
puts "Hello, TracePoint!"
# ...
# [69, IRB::Notifier::AbstractNotifier, :printf, :call]
# ...
//}
トレースを無効に......定義、特異クラス定義、モジュール定義の終了。
: :call
Ruby で記述されたメソッドの呼び出し。
: :return
Ruby で記述されたメソッド呼び出しからのリターン。
: :c_call
C で記述されたメソッドの呼び出し。
: :c_return......C で記述されたメソッド呼び出しからのリターン。
: :raise
例外の発生。
: :b_call
ブロックの開始。
: :b_return
ブロックの終了。
: :thread_begin
スレッドの開始。
: :thread_end
スレッドの終了。
指定イベントに関連......C で記述されたメソッド呼び出しからのリターン。
: :raise
例外の発生。
: :b_call
ブロックの開始。
: :b_return
ブロックの終了。
: :thread_begin
スレッドの開始。
: :thread_end
スレッドの終了。
: :fiber_switch
ファイ... -
Proc
. new -> Proc (9.0) -
ブロックをコンテキストとともにオブジェクト化して返します。
...クがないのにブロックを省略した呼び出しを行ったときに発生します。
//emlist[例][ruby]{
def foo
pr = Proc.new
pr.call(1)
end
foo {|arg| p arg }
# => 1
//}
これは以下と同じです。
//emlist[例][ruby]{
def foo
yield(1)
end
foo {|arg| p arg }
# => 1
//}... -
Proc
. new { . . . } -> Proc (9.0) -
ブロックをコンテキストとともにオブジェクト化して返します。
...クがないのにブロックを省略した呼び出しを行ったときに発生します。
//emlist[例][ruby]{
def foo
pr = Proc.new
pr.call(1)
end
foo {|arg| p arg }
# => 1
//}
これは以下と同じです。
//emlist[例][ruby]{
def foo
yield(1)
end
foo {|arg| p arg }
# => 1
//}......ise ArgumentError ブロックを省略した呼び出しを行ったときに発生します。
//emlist[][ruby]{
pr = Proc.new {|arg| p arg }
pr.call(1) # => 1
//}
//emlist[][ruby]{
Proc.new # => -e:1:in `new': tried to create Proc object without a block (ArgumentError)
//}
Proc.new は、Proc#... -
RubyVM
:: AbstractSyntaxTree . parse _ file(pathname) -> RubyVM :: AbstractSyntaxTree :: Node (9.0) -
pathname のファイルを読み込み、その内容を抽象構文木にパースし、その木の根ノードを返します。
...byVM::AbstractSyntaxTree.parse_file(__FILE__)
# => (SCOPE@1:0-1:50
# tbl: []
# args: nil
# body:
# (FCALL@1:0-1:50 :pp
# (LIST@1:3-1:50
# (CALL@1:3-1:50
# (COLON2@1:3-1:29 (CONST@1:3-1:9 :RubyVM) :AbstractSyntaxTree)
# :parse_file... -
RubyVM
:: AbstractSyntaxTree . parse _ file(pathname , keep _ script _ lines: false , error _ tolerant: false , keep _ tokens: false) -> RubyVM :: AbstractSyntaxTree :: Node (9.0) -
pathname のファイルを読み込み、その内容を抽象構文木にパースし、その木の根ノードを返します。
...byVM::AbstractSyntaxTree.parse_file(__FILE__)
# => (SCOPE@1:0-1:50
# tbl: []
# args: nil
# body:
# (FCALL@1:0-1:50 :pp
# (LIST@1:3-1:50
# (CALL@1:3-1:50
# (COLON2@1:3-1:29 (CONST@1:3-1:9 :RubyVM) :AbstractSyntaxTree)
# :parse_file... -
Thread
. report _ on _ exception -> bool (9.0) -
真の時は、いずれかのスレッドが例外によって終了した時に、その内容を $stderr に報告します。
...は $stderr に以下のように出力します:
#<Thread:...> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
2: from -e:1:in `block in <main>'
1: from -e:1:in `times'
これによってスレッドのエラーを早期に捕捉... -
Thread
. report _ on _ exception=(newstate) (9.0) -
真の時は、いずれかのスレッドが例外によって終了した時に、その内容を $stderr に報告します。
...は $stderr に以下のように出力します:
#<Thread:...> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
2: from -e:1:in `block in <main>'
1: from -e:1:in `times'
これによってスレッドのエラーを早期に捕捉... -
TracePoint
. trace(*events) {|obj| . . . } -> TracePoint (9.0) -
新しい TracePoint オブジェクトを作成して自動的にトレースを開始し ます。TracePoint.new のコンビニエンスメソッドです。
...す。指定できる値については
TracePoint.new を参照してください。
//emlist[例][ruby]{
trace = TracePoint.trace(:call) { |tp| [tp.lineno, tp.event] }
# => #<TracePoint:0x007f786a452448>
trace.enabled? # => true
//}
@raise ThreadError ブロックを指定しな...