Ruby 2.1.0 リファレンスマニュアル > ライブラリ一覧 > 組み込みライブラリ > RubyVM::InstructionSequenceクラス

class RubyVM::InstructionSequence

クラス・モジュールの継承リスト: RubyVM::InstructionSequence < Object < Kernel < BasicObject

要約

Ruby の Virtual Machine のコンパイル済みの命令シーケンスを表すクラスです。

MethodProc オブジェクトや Ruby のソースコードを表す文字列から VM の命令シーケンスを得る事ができます。また、 RubyVM::InstructionSequence オブジェクトを元に命令シーケンスを読みやすい文字列に変換する事もできます。Ruby の命令シーケンスコンパイラの設定を扱う必要がありますが、Ruby の VM がどのように働くかを知るのに有用です。

VM の命令シーケンスの一覧はRuby のソースコード中の insns.def から参照できます。

特異メソッド

定義 説明
compile(source, file = nil, path = nil, line = 1, options = nil) -> RubyVM::InstructionSequence
new(source, file = nil, path = nil, line = 1, options = nil) -> RubyVM::InstructionSequence

引数 source で指定した Ruby のソースコードを元にコンパイル済みの RubyVM::InstructionSequence オブジェクトを作成して返します。

compile_file(file, options = nil) -> RubyVM::InstructionSequence

引数 file で指定した Ruby のソースコードを元にコンパイル済みの RubyVM::InstructionSequence オブジェクトを作成して返します。

compile_option -> Hash

命令シーケンスのコンパイル時のデフォルトの最適化オプションを Hash で返します。

compile_option=(options)

命令シーケンスのコンパイル時のデフォルトの最適化オプションを引数 options で指定します。

disasm(body) -> String
disassemble(body) -> String

引数 body で指定したオブジェクトから作成した RubyVM::InstructionSequence オブジェクトを人間が読める形式の文字列に変換して返します。

of(body) -> RubyVM::InstructionSequence

引数 body で指定した ProcMethod オブジェクトを元に RubyVM::InstructionSequence オブジェクトを作成して返します。

インスタンスメソッド

定義 説明
absolute_path -> String | nil

self が表す命令シーケンスの絶対パスを返します。

base_label -> String

self が表す命令シーケンスの基本ラベルを返します。

disasm -> String
disassemble -> String

self が表す命令シーケンスを人間が読める形式の文字列に変換して返します。

eval -> object

self の命令シーケンスを評価してその結果を返します。

first_lineno -> Integer

self が表す命令シーケンスの 1 行目の行番号を返します。

inspect -> String

self の情報をラベルとパスを含んだ人間に読みやすい文字列にして返します。

label -> String

self が表す命令シーケンスのラベルを返します。通常、メソッド名、クラス名、モジュール名などで構成されます。

path -> String

self が表す命令シーケンスの相対パスを返します。

to_a -> Array

self の情報を 14 要素の配列にして返します。

継承したメソッド

! != __id__ __send__ instance_eval instance_exec method_missing singleton_method_added singleton_method_removed singleton_method_undefined !~ <=> == === =~ _dump class clone define_singleton_method display enum_for eql? equal? extend freeze frozen? hash initialize initialize_copy instance_of? instance_variable_defined? instance_variable_get instance_variable_set instance_variables is_a? itself marshal_dump marshal_load method methods must_be must_be_close_to must_be_empty must_be_instance_of must_be_kind_of must_be_nil must_be_same_as must_be_within_epsilon must_equal must_include must_match must_raise must_respond_to must_send must_throw nil? object_id pretty_inspect pretty_print pretty_print_cycle pretty_print_inspect pretty_print_instance_variables private_methods protected_methods psych_to_yaml public_method public_methods public_send remove_instance_variable respond_to? respond_to_missing? send singleton_class singleton_method singleton_methods taint tainted? tap to_ary to_hash to_int to_io to_proc to_regexp to_s to_str trust untaint untrust untrusted? .yaml_tag ::ARGF ::ARGV ::DATA ::ENV ::FALSE ::NIL ::RUBY_COPYRIGHT ::RUBY_DESCRIPTION ::RUBY_ENGINE ::RUBY_PATCHLEVEL ::RUBY_PLATFORM ::RUBY_RELEASE_DATE ::RUBY_REVISION ::RUBY_VERSION ::SCRIPT_LINES__ ::STDERR ::STDIN ::STDOUT ::TOPLEVEL_BINDING ::TRUE