From 9e872e7d36f5cf03b18851728aa2824193f7722b Mon Sep 17 00:00:00 2001 From: kares Date: Tue, 29 May 2012 12:23:55 +0200 Subject: [PATCH] inspect seems to print non-sense for native rhino objects --- lib/rhino/rhino_ext.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/rhino/rhino_ext.rb b/lib/rhino/rhino_ext.rb index 08c816e..158d269 100644 --- a/lib/rhino/rhino_ext.rb +++ b/lib/rhino/rhino_ext.rb @@ -85,6 +85,13 @@ class Java::OrgMozillaJavascript::ScriptableObject to_h.to_json(*args) end + # make sure inspect prints the same as to_s (on --1.8) + # otherwise JRuby might play it a little smart e.g. : + # "#<#:0x557c15>" instead of "Error: bar" + def inspect + toString + end + # Delegate methods to JS object if possible when called from Ruby. def method_missing(name, *args) name_str = name.to_s