Class: Rubinius::Debugger::Frame
- Inherits:
-
Object
- Object
- Rubinius::Debugger::Frame
- Defined in:
- lib/rubinius/debugger/frame.rb
Instance Attribute Summary collapse
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
Instance Method Summary collapse
- #binding ⇒ Object
- #describe ⇒ Object
-
#initialize(debugger, number, loc) ⇒ Frame
constructor
A new instance of Frame.
- #ip ⇒ Object
- #line ⇒ Object
- #local_variables ⇒ Object
- #method ⇒ Object
- #run(code) ⇒ Object
- #variables ⇒ Object
Constructor Details
#initialize(debugger, number, loc) ⇒ Frame
Returns a new instance of Frame.
3 4 5 6 7 |
# File 'lib/rubinius/debugger/frame.rb', line 3 def initialize(debugger, number, loc) @debugger = debugger @number = number @location = loc end |
Instance Attribute Details
#location ⇒ Object (readonly)
Returns the value of attribute location.
9 10 11 |
# File 'lib/rubinius/debugger/frame.rb', line 9 def location @location end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
9 10 11 |
# File 'lib/rubinius/debugger/frame.rb', line 9 def number @number end |
Instance Method Details
#binding ⇒ Object
15 16 17 18 19 20 |
# File 'lib/rubinius/debugger/frame.rb', line 15 def binding @binding ||= Binding.setup( @location.variables, @location.method, @location.constant_scope) end |
#describe ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/rubinius/debugger/frame.rb', line 42 def describe if method.required_args > 0 locals = [] 0.upto(method.required_args-1) do |arg| locals << method.local_names[arg].to_s end arg_str = locals.join(", ") else arg_str = "" end loc = @location if loc.is_block if arg_str.empty? recv = "{ } in #{loc.describe_receiver}#{loc.name}" else recv = "{|#{arg_str}| } in #{loc.describe_receiver}#{loc.name}" end else if arg_str.empty? recv = loc.describe else recv = "#{loc.describe}(#{arg_str})" end end str = "#{recv} at #{loc.method.active_path}:#{loc.line} (#{loc.ip})" if @debugger.variables[:show_ip] str << " (+#{loc.ip})" end str end |
#ip ⇒ Object
30 31 32 |
# File 'lib/rubinius/debugger/frame.rb', line 30 def ip @location.ip end |
#line ⇒ Object
26 27 28 |
# File 'lib/rubinius/debugger/frame.rb', line 26 def line @location.line end |
#local_variables ⇒ Object
38 39 40 |
# File 'lib/rubinius/debugger/frame.rb', line 38 def local_variables method.local_names end |
#method ⇒ Object
22 23 24 |
# File 'lib/rubinius/debugger/frame.rb', line 22 def method @location.method end |
#run(code) ⇒ Object
11 12 13 |
# File 'lib/rubinius/debugger/frame.rb', line 11 def run(code) eval(code, binding) end |
#variables ⇒ Object
34 35 36 |
# File 'lib/rubinius/debugger/frame.rb', line 34 def variables @location.variables end |