種類
- インスタンスメソッド (11)
- 特異メソッド (4)
- 変数 (2)
クラス
- Binding (1)
-
RubyVM
:: InstructionSequence (7) - Thread (5)
- TracePoint (1)
モジュール
- Kernel (2)
-
RubyVM
:: AbstractSyntaxTree (1)
キーワード
-
$ -K (1) -
$ KCODE (1) -
absolute
_ path (1) - backtrace (1)
-
base
_ label (1) -
compile
_ file (1) -
first
_ lineno (1) - inspect (1)
- label (1)
- name= (1)
- new (1)
- of (2)
- path (1)
-
report
_ on _ exception (1) -
to
_ s (1)
検索結果
先頭5件
-
Binding
# irb -> object (54664.0) -
REPLのセッションを開始します。
REPLのセッションを開始します。
2.5.0 からは require 'irb' せずに直接 binding.irb を呼び出しても使えるようになりました。
@see irb -
Kernel
$ $ -K -> nil (18343.0) -
この特殊変数は何の影響も持たなくなりました。
この特殊変数は何の影響も持たなくなりました。
値を代入しても無視され、参照すると常に nil です。
>> $KCODE = true
(irb):1: warning: variable $KCODE is no longer effective; ignored
=> true
>> $KCODE
(irb):2: warning: variable $KCODE is no longer effective
=> nil
@see spec/rubycmd -
Kernel
$ $ KCODE -> nil (9343.0) -
この特殊変数は何の影響も持たなくなりました。
この特殊変数は何の影響も持たなくなりました。
値を代入しても無視され、参照すると常に nil です。
>> $KCODE = true
(irb):1: warning: variable $KCODE is no longer effective; ignored
=> true
>> $KCODE
(irb):2: warning: variable $KCODE is no longer effective
=> nil
@see spec/rubycmd -
RubyVM
:: AbstractSyntaxTree . of(proc) -> RubyVM :: AbstractSyntaxTree :: Node (505.0) -
引数 proc に渡したProcやメソッドオブジェクトの抽象構文木を返します。
引数 proc に渡したProcやメソッドオブジェクトの抽象構文木を返します。
このメソッドはProcやメソッドが定義されたファイルを読み込む必要があるため、
irbのようなファイルを介さない対話的環境では動作しません。
@param proc Procもしくはメソッドオブジェクトを指定します。
//emlist[][ruby]{
pp RubyVM::AbstractSyntaxTree.of(proc {1 + 2})
# => (SCOPE@2:38-2:45
# tbl: []
# args: nil
# body:
# (OPCALL@2:... -
RubyVM
:: InstructionSequence . of(body) -> RubyVM :: InstructionSequence (397.0) -
引数 body で指定した Proc、Method オブジェクトを元に RubyVM::InstructionSequence オブジェクトを作成して返します。
引数 body で指定した Proc、Method オブジェクトを元に
RubyVM::InstructionSequence オブジェクトを作成して返します。
@param body Proc、Method オブジェクトを指定します。
例1:irb で実行した場合
# proc
> p = proc { num = 1 + 2 }
> RubyVM::InstructionSequence.of(p)
> # => <RubyVM::InstructionSequence:block in irb_binding@(irb)>
# method
> def ... -
Thread
# backtrace -> [String] | nil (397.0) -
スレッドの現在のバックトレースを返します。
スレッドの現在のバックトレースを返します。
スレッドがすでに終了している場合は nil を返します。
//emlist[例][ruby]{
class C1
def m1
sleep 5
end
def m2
m1
end
end
th = Thread.new {C1.new.m2; Thread.stop}
th.backtrace
# => [
# [0] "(irb):3:in `sleep'",
# [1] "(irb):3:in `m1'",
# [2] "(irb):6:in `m2'",
# [3] ... -
Thread
# report _ on _ exception -> bool (397.0) -
真の場合、そのスレッドが例外によって終了した時に、その内容を $stderr に報告します。
真の場合、そのスレッドが例外によって終了した時に、その内容を $stderr に報告します。
デフォルトはスレッド作成時の Thread.report_on_exception です。
@param newstate スレッド実行中に例外発生した場合、その内容を報告するかどうかを true か false で指定します。
//emlist[例][ruby]{
a = Thread.new{ Thread.stop; raise }
a.report_on_exception = true
a.report_on_exception # => true
a.run
# => #<Th... -
RubyVM
:: InstructionSequence # absolute _ path -> String | nil (343.0) -
self が表す命令シーケンスの絶対パスを返します。
self が表す命令シーケンスの絶対パスを返します。
self を文字列から作成していた場合は nil を返します。
例1:irb で実行した場合
iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
iseq.absolute_path
# => nil
例2: RubyVM::InstructionSequence.compile_file を使用した場合
# /tmp/method.... -
RubyVM
:: InstructionSequence # base _ label -> String (343.0) -
self が表す命令シーケンスの基本ラベルを返します。
self が表す命令シーケンスの基本ラベルを返します。
例1:irb で実行した場合
iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
iseq.base_label
# => "<compiled>"
例2: RubyVM::InstructionSequence.compile_file を使用した場合
# /tmp/method.rb
def hello
puts "h... -
RubyVM
:: InstructionSequence # first _ lineno -> Integer (343.0) -
self が表す命令シーケンスの 1 行目の行番号を返します。
self が表す命令シーケンスの 1 行目の行番号を返します。
例1:irb で実行した場合
RubyVM::InstructionSequence.compile('num = 1 + 2').first_lineno
# => 1
例2:
# /tmp/method.rb
require "foo-library"
def foo
p :foo
end
RubyVM::InstructionSequence.of(method(:foo)).first_lineno
# => 2 -
RubyVM
:: InstructionSequence # label -> String (343.0) -
self が表す命令シーケンスのラベルを返します。通常、メソッド名、クラス名、 モジュール名などで構成されます。
self が表す命令シーケンスのラベルを返します。通常、メソッド名、クラス名、
モジュール名などで構成されます。
トップレベルでは "<main>" を返します。self を文字列から作成していた場合
は "<compiled>" を返します。
例1:irb で実行した場合
iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
iseq.label
# => "<compiled>"
例2: R... -
RubyVM
:: InstructionSequence # path -> String (343.0) -
self が表す命令シーケンスの相対パスを返します。
self が表す命令シーケンスの相対パスを返します。
self の作成時に指定した文字列を返します。self を文字列から作成していた
場合は "<compiled>" を返します。
例1:irb で実行した場合
iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
iseq.path
# => "<compiled>"
例2: RubyVM::InstructionSequence.compi... -
TracePoint
. new(*events) {|obj| . . . } -> TracePoint (343.0) -
新しい TracePoint オブジェクトを作成して返します。トレースを有効 にするには TracePoint#enable を実行してください。
新しい TracePoint オブジェクトを作成して返します。トレースを有効
にするには TracePoint#enable を実行してください。
//emlist[例:irb で実行した場合][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!"
# .... -
RubyVM
:: InstructionSequence . compile _ file(file , options = nil) -> RubyVM :: InstructionSequence (325.0) -
引数 file で指定した Ruby のソースコードを元にコンパイル済みの RubyVM::InstructionSequence オブジェクトを作成して返します。
引数 file で指定した Ruby のソースコードを元にコンパイル済みの
RubyVM::InstructionSequence オブジェクトを作成して返します。
RubyVM::InstructionSequence.compile とは異なり、file、path などの
メタデータは自動的に取得します。
@param file ファイル名を文字列で指定します。
@param options コンパイル時のオプションを true、false、Hash オブ
ジェクトのいずれかで指定します。詳細は
RubyVM::Instr... -
Thread
# inspect -> String (325.0) -
自身を人間が読める形式に変換した文字列を返します。
自身を人間が読める形式に変換した文字列を返します。
//emlist[例][ruby]{
a = Thread.current
a.inspect # => "#<Thread:0x00007fdbaf07ddb0 run>"
b = Thread.new{}
b.inspect # => "#<Thread:0x00007fdbaf8f7d10@(irb):3 dead>"
//} -
Thread
# name=(name) -> String (325.0) -
self の名前を name に設定します。
self の名前を name に設定します。
プラットフォームによっては pthread やカーネルにも設定を行う場合があります。
@raise ArgumentError 引数に ASCII 互換ではないエンコーディングのものを
指定した場合に発生します。
//emlist[例][ruby]{
a = Thread.new{}
a.name = 'named'
a.name # => "named"
a.inspect # => "#<Thread:0x00007f85ac8721f0@named@(irb):1 dead>"
... -
Thread
# to _ s -> String (325.0) -
自身を人間が読める形式に変換した文字列を返します。
自身を人間が読める形式に変換した文字列を返します。
//emlist[例][ruby]{
a = Thread.current
a.inspect # => "#<Thread:0x00007fdbaf07ddb0 run>"
b = Thread.new{}
b.inspect # => "#<Thread:0x00007fdbaf8f7d10@(irb):3 dead>"
//}