Skip to content

Commit

Permalink
Showing 1 changed file with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -240,7 +240,25 @@ public ToSNode(ToSNode prev) {
public RubyString toS(RubyEncoding encoding) {
return getContext().makeString(encoding.getName());
}

}

@CoreMethod(names = "inspect")
public abstract static class InspectNode extends CoreMethodNode {

public InspectNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}

public InspectNode(InspectNode prev) {
super(prev);
}

@CompilerDirectives.SlowPath
@Specialization
public RubyString toS(RubyEncoding encoding) {
RubyString name = getContext().makeString(encoding.getName());

return getContext().makeString(String.format("#<Encoding:%s>", name.toString()));
}
}
}

0 comments on commit 4bf8f6e

Please sign in to comment.