Class: Readapt::Frame
- Inherits:
-
Object
- Object
- Readapt::Frame
- Defined in:
- lib/readapt/frame.rb,
ext/readapt/frame.c
Constant Summary collapse
- NULL_FRAME =
Frame.new("", 0, nil)
Instance Method Summary collapse
- #binding_id ⇒ Integer
- #evaluate(code) ⇒ Object
- #file ⇒ String
- #frame_binding ⇒ Object
- #initialize(file, line, binding) ⇒ Object constructor
- #line ⇒ Integer
- #local(sym) ⇒ Object
- #local_id ⇒ Object
- #locals ⇒ Object
Constructor Details
#initialize(file, line, binding) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/readapt/frame.rb', line 11 class Frame def evaluate code frame_binding.eval(code).inspect rescue StandardError => e "[#{e.class}] #{e.}" end def local_id frame_binding.object_id end def locals return [] if frame_binding.nil? result = [] frame_binding.local_variables.sort.each do |sym| var = frame_binding.local_variable_get(sym) result.push Variable.new(sym, var) end result.push Variable.new(:self, frame_binding.receiver) result end def local sym return frame_binding.receiver if sym == :self frame_binding.local_variable_get sym end NULL_FRAME = Frame.new("", 0, nil) end |
Instance Method Details
#binding_id ⇒ Integer
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/readapt/frame.rb', line 11 class Frame def evaluate code frame_binding.eval(code).inspect rescue StandardError => e "[#{e.class}] #{e.}" end def local_id frame_binding.object_id end def locals return [] if frame_binding.nil? result = [] frame_binding.local_variables.sort.each do |sym| var = frame_binding.local_variable_get(sym) result.push Variable.new(sym, var) end result.push Variable.new(:self, frame_binding.receiver) result end def local sym return frame_binding.receiver if sym == :self frame_binding.local_variable_get sym end NULL_FRAME = Frame.new("", 0, nil) end |
#evaluate(code) ⇒ Object
12 13 14 15 16 |
# File 'lib/readapt/frame.rb', line 12 def evaluate code frame_binding.eval(code).inspect rescue StandardError => e "[#{e.class}] #{e.}" end |
#file ⇒ String
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/readapt/frame.rb', line 11 class Frame def evaluate code frame_binding.eval(code).inspect rescue StandardError => e "[#{e.class}] #{e.}" end def local_id frame_binding.object_id end def locals return [] if frame_binding.nil? result = [] frame_binding.local_variables.sort.each do |sym| var = frame_binding.local_variable_get(sym) result.push Variable.new(sym, var) end result.push Variable.new(:self, frame_binding.receiver) result end def local sym return frame_binding.receiver if sym == :self frame_binding.local_variable_get sym end NULL_FRAME = Frame.new("", 0, nil) end |
#frame_binding ⇒ Object
122 123 124 125 126 127 |
# File 'ext/readapt/frame.c', line 122
VALUE frame_binding_m(VALUE self)
{
frame_t *data;
TypedData_Get_Struct(self, frame_t, &frame_type, data);
return data->binding;
}
|
#line ⇒ Integer
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/readapt/frame.rb', line 11 class Frame def evaluate code frame_binding.eval(code).inspect rescue StandardError => e "[#{e.class}] #{e.}" end def local_id frame_binding.object_id end def locals return [] if frame_binding.nil? result = [] frame_binding.local_variables.sort.each do |sym| var = frame_binding.local_variable_get(sym) result.push Variable.new(sym, var) end result.push Variable.new(:self, frame_binding.receiver) result end def local sym return frame_binding.receiver if sym == :self frame_binding.local_variable_get sym end NULL_FRAME = Frame.new("", 0, nil) end |
#local(sym) ⇒ Object
33 34 35 36 |
# File 'lib/readapt/frame.rb', line 33 def local sym return frame_binding.receiver if sym == :self frame_binding.local_variable_get sym end |
#local_id ⇒ Object
18 19 20 |
# File 'lib/readapt/frame.rb', line 18 def local_id frame_binding.object_id end |
#locals ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/readapt/frame.rb', line 22 def locals return [] if frame_binding.nil? result = [] frame_binding.local_variables.sort.each do |sym| var = frame_binding.local_variable_get(sym) result.push Variable.new(sym, var) end result.push Variable.new(:self, frame_binding.receiver) result end |