to_a

iseq.to_a â ary
Instance Public methods

Returns an Array with 14 elements representing the instruction sequence with the following data:

magic

A string identifying the data format. Always YARVInstructionSequence/SimpleDataFormat.

major_version

The major version of the instruction sequence.

minor_version

The minor version of the instruction sequence.

format_type

A number identifying the data format. Always 1.

misc

A hash containing:

:arg_size

the total number of arguments taken by the method or the block (0 if iseq doesn't represent a method or block)

:local_size

the number of local variables + 1

:stack_max

used in calculating the stack depth at which a SystemStackError is thrown.

label

The name of the context (block, method, class, module, etc.) that this instruction sequence belongs to.

<main> if it's at the top level, <compiled> if it was evaluated from a string.

path

The relative path to the Ruby file where the instruction sequence was loaded from.

<compiled> if the iseq was evaluated from a string.

absolute_path

The absolute path to the Ruby file where the instruction sequence was loaded from.

nil if the iseq was evaluated from a string.

first_lineno

The number of the first source line where the instruction sequence was loaded from.

type

The type of the instruction sequence.

Valid values are :top, :method, :block, :class, :rescue, :ensure, :eval, :main, and :defined_guard.

locals

An array containing the names of all arguments and local variables as symbols.

args

The arity if the method or block only has required arguments.

Otherwise an array of:

[required_argc, [optional_arg_labels, ...],
 splat_index, post_splat_argc, post_splat_index,
 block_index, simple]

More info about these values can be found in vm_core.h.

catch_table

A list of exceptions and control flow operators (rescue, next, redo, break, etc.).

bytecode

An array of arrays containing the instruction names and operands that make up the body of the instruction sequence.

doc_ruby_on_rails
2015-05-13 21:32:15
Comments
Leave a Comment

Please login to continue.