Class: RubyJard::Frame

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_jard/frame.rb

Overview

This class is a wrapper for Byebug::Frame. This class prevents direct access to Byebug’s internal data structure, provides some more helpers and make Jard easier to test.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context, real_pos, virtual_pos: nil) ⇒ Frame

Returns a new instance of Frame.



13
14
15
16
17
18
19
# File 'lib/ruby_jard/frame.rb', line 13

def initialize(context, real_pos, virtual_pos: nil)
  @context = context
  @real_pos = real_pos
  @virtual_pos = virtual_pos

  @visible = true
end

Instance Attribute Details

#real_posObject (readonly)

Returns the value of attribute real_pos.



9
10
11
# File 'lib/ruby_jard/frame.rb', line 9

def real_pos
  @real_pos
end

#virtual_posObject

Returns the value of attribute virtual_pos.



11
12
13
# File 'lib/ruby_jard/frame.rb', line 11

def virtual_pos
  @virtual_pos
end

#visible=(value) ⇒ Object (writeonly)

Sets the attribute visible

Parameters:

  • value

    the value to set the attribute visible to.



10
11
12
# File 'lib/ruby_jard/frame.rb', line 10

def visible=(value)
  @visible = value
end

Instance Method Details

#c_frame?Boolean

Returns:

  • (Boolean)


60
61
62
# File 'lib/ruby_jard/frame.rb', line 60

def c_frame?
  frame_binding.nil?
end

#frame_bindingObject



52
53
54
# File 'lib/ruby_jard/frame.rb', line 52

def frame_binding
  @context.frame_binding(@real_pos)
end

#frame_classObject



48
49
50
# File 'lib/ruby_jard/frame.rb', line 48

def frame_class
  @context.frame_class(@real_pos)
end

#frame_fileObject



29
30
31
# File 'lib/ruby_jard/frame.rb', line 29

def frame_file
  @context.frame_file(@real_pos)
end

#frame_lineObject



33
34
35
# File 'lib/ruby_jard/frame.rb', line 33

def frame_line
  @context.frame_line(@real_pos)
end

#frame_locationObject



37
38
39
40
41
42
# File 'lib/ruby_jard/frame.rb', line 37

def frame_location
  frame_backtrace = @context.backtrace[@real_pos]
  return nil if frame_backtrace.nil?

  frame_backtrace.first
end

#frame_methodObject



56
57
58
# File 'lib/ruby_jard/frame.rb', line 56

def frame_method
  @context.frame_method(@real_pos)
end

#frame_selfObject



44
45
46
# File 'lib/ruby_jard/frame.rb', line 44

def frame_self
  @context.frame_self(@real_pos)
end

#hidden?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/ruby_jard/frame.rb', line 25

def hidden?
  @visible == false
end

#threadObject



64
65
66
# File 'lib/ruby_jard/frame.rb', line 64

def thread
  @context.thread
end

#visible?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/ruby_jard/frame.rb', line 21

def visible?
  @visible == true
end