summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-01 12:09:17 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-01 12:09:17 +0000
commitc906e879d8e83263752a25faf34cc102a7b2e60e (patch)
treeaed64622f12505c33d291b42f6077a2fb628d661
parent01eb117b01576e5b8386af5b6b425655f314888c (diff)
* 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
-rw-r--r--ChangeLog6
-rw-r--r--vm_backtrace.c7
2 files changed, 13 insertions, 0 deletions
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 <ko1@atdot.net>
+
+ * 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 <nobu@ruby-lang.org>
* 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);