Class: Ruby::Reflection::StackFrameMirror

Inherits:
Mirror show all
Includes:
AbstractReflection::StackFrameMirror
Defined in:
lib/ruby/reflection/stack_frame_mirror.rb

Instance Attribute Summary collapse

Attributes included from AbstractReflection::Mirror

#reflection

Instance Method Summary collapse

Methods included from AbstractReflection::StackFrameMirror

#arguments, #binding, #ip_offset, #locals, #pop, #receiver, #restart, #self, #step, #variable_context

Methods included from AbstractReflection::Mirror

#mirrors?, #reflectee

Methods included from AbstractReflection::Mirror::ClassMethods

#included, #mirror_class, #new, #reflect, #reflect!, #reflects?, #register_mirror

Constructor Details

#initialize(obj) ⇒ StackFrameMirror

Returns a new instance of StackFrameMirror.



10
11
12
13
14
15
16
# File 'lib/ruby/reflection/stack_frame_mirror.rb', line 10

def initialize(obj)
  super
  @name = obj.method
  @index = obj.index
  @method = find_method_for(obj.file, obj.line)
  @thread = obj.thread
end

Instance Attribute Details

#methodObject (readonly)

Returns the value of attribute method.



8
9
10
# File 'lib/ruby/reflection/stack_frame_mirror.rb', line 8

def method
  @method
end

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/ruby/reflection/stack_frame_mirror.rb', line 7

def name
  @name
end

Instance Method Details

#selectorObject



29
30
31
# File 'lib/ruby/reflection/stack_frame_mirror.rb', line 29

def selector
  @name
end

#source_offsetObject



22
23
24
25
26
27
# File 'lib/ruby/reflection/stack_frame_mirror.rb', line 22

def source_offset
  if next_frame = @thread.stack[@index - 1]
    s = @method.send_offsets[next_frame.name]
  end
  s || raise(CapabilitiesExceeded)
end

#step_offsetObject



18
19
20
# File 'lib/ruby/reflection/stack_frame_mirror.rb', line 18

def step_offset
  @method.step_offsets.index(source_offset)
end