Class: RShade::StackFrame
Overview
nodoc
Instance Attribute Summary collapse
-
#hash ⇒ Object
readonly
Returns the value of attribute hash.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(hash) ⇒ StackFrame
constructor
A new instance of StackFrame.
- #path ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(hash) ⇒ StackFrame
Returns a new instance of StackFrame.
8 9 10 |
# File 'lib/rshade/stack_frame.rb', line 8 def initialize(hash) @hash = hash end |
Instance Attribute Details
#hash ⇒ Object (readonly)
Returns the value of attribute hash.
6 7 8 |
# File 'lib/rshade/stack_frame.rb', line 6 def hash @hash end |
Class Method Details
.from_binding(binding_frame) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/rshade/stack_frame.rb', line 23 def self.from_binding(binding_frame) source_location = { path: binding_frame.source_location[0], line: binding_frame.source_location[1] } local_vars = binding_frame.local_variables.each_with_object({}) do |var_name, memo| value = binding_frame.local_variable_get(var_name) type = value.is_a?(Class) ? value : value.class memo[var_name] = { name: var_name, value: value, type: type.to_s } end receiver_variables = binding_frame.receiver.instance_variables.each_with_object({}) do |var_name, memo| value = binding_frame.receiver.instance_variable_get(var_name) type = value.is_a?(Class) ? value : value.class memo[var_name] = { name: var_name, value: value, type: type.to_s } end hash = { source_location: source_location, local_vars: local_vars, source: {}, receiver_variables: receiver_variables } new(hash) end |