Skip to content

Commit

Permalink
Showing 2 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -2231,7 +2231,7 @@ public String toHexString(RubyBignum value) {

}

@CoreMethod(names = {"to_s", "inspect"})
@CoreMethod(names = "to_s")
public abstract static class ToSNode extends CoreMethodNode {

@Child private ClassNode classNode;
17 changes: 17 additions & 0 deletions truffle/src/main/ruby/jruby/truffle/core/shims.rb
Original file line number Diff line number Diff line change
@@ -184,4 +184,21 @@ def rindex(obj)

index
end
end

module Kernel
def inspect
ivars = instance_variables

return to_s if ivars.empty?

prefix = "#<#{self.class}:0x#{self.object_id.to_s(16)}"

parts = []
ivars.each do |var|
parts << "#{var}=#{instance_variable_get(var).inspect}"
end

"#{prefix} #{parts.join(', ')}>"
end
end

0 comments on commit 69fcbdf

Please sign in to comment.