123456789_123456789_123456789_123456789_123456789_

Class: Prism::Debug::ISeq

Do not use. This class is for internal use only.
Relationships & Source Files
Inherits: Object
Defined in: lib/prism/debug.rb

Overview

A wrapper around a RubyVM::InstructionSequence that provides a more convenient interface for accessing parts of the iseq.

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(parts) ⇒ ISeq

[ GitHub ]

  
# File 'lib/prism/debug.rb', line 12

def initialize(parts)
  @parts = parts
end

Instance Attribute Details

#parts (readonly)

[ GitHub ]

  
# File 'lib/prism/debug.rb', line 10

attr_reader :parts

Instance Method Details

#each_child

[ GitHub ]

  
# File 'lib/prism/debug.rb', line 28

def each_child
  instructions.each do |instruction|
    # Only look at arrays. Other instructions are line numbers or
    # tracepoint events.
    next unless instruction.is_a?(Array)

    instruction.each do |opnd|
      # Only look at arrays. Other operands are literals.
      next unless opnd.is_a?(Array)

      # Only look at instruction sequences. Other operands are literals.
      next unless opnd[0] == "YARVInstructionSequence/SimpleDataFormat"

      yield ISeq.new(opnd)
    end
  end
end

#instructions

[ GitHub ]

  
# File 'lib/prism/debug.rb', line 24

def instructions
  parts[13]
end

#local_table

[ GitHub ]

  
# File 'lib/prism/debug.rb', line 20

def local_table
  parts[10]
end

#type

[ GitHub ]

  
# File 'lib/prism/debug.rb', line 16

def type
  parts[0]
end