From c906e879d8e83263752a25faf34cc102a7b2e60e Mon Sep 17 00:00:00 2001 From: ko1 Date: Sat, 1 Dec 2012 12:09:17 +0000 Subject: * vm_backtrace.c (location_inspect_m): add Thread::Backtrace::Location#inspect. It same as loc_obj.to_s.inspect. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38121 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ vm_backtrace.c | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/ChangeLog b/ChangeLog index d5d1af45f1..25fadc70d7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Sat Dec 1 21:06:58 2012 Koichi Sasada + + * vm_backtrace.c (location_inspect_m): add + Thread::Backtrace::Location#inspect. + It same as loc_obj.to_s.inspect. + Sat Dec 1 19:24:09 2012 Nobuyoshi Nakada * io.c (rb_io_puts): recurse for the argument itself, not converted diff --git a/vm_backtrace.c b/vm_backtrace.c index 9dcb76de1e..8e10d6eb73 100644 --- a/vm_backtrace.c +++ b/vm_backtrace.c @@ -300,6 +300,12 @@ location_to_str_m(VALUE self) return location_to_str(location_ptr(self)); } +static VALUE +location_inspect_m(VALUE self) +{ + return rb_str_inspect(location_to_str(location_ptr(self))); +} + typedef struct rb_backtrace_struct { rb_backtrace_location_t *backtrace; rb_backtrace_location_t *backtrace_base; @@ -860,6 +866,7 @@ Init_vm_backtrace(void) rb_define_method(rb_cBacktraceLocation, "path", location_path_m, 0); rb_define_method(rb_cBacktraceLocation, "absolute_path", location_absolute_path_m, 0); rb_define_method(rb_cBacktraceLocation, "to_s", location_to_str_m, 0); + rb_define_method(rb_cBacktraceLocation, "inspect", location_inspect_m, 0); rb_define_global_function("caller", rb_f_caller, -1); rb_define_global_function("caller_locations", rb_f_caller_locations, -1); -- cgit v1.2.3