Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Re-apply fix. I think merge replaced it GH-2182
  • Loading branch information
enebo committed Feb 9, 2015
1 parent 4c6a550 commit ad4a92e
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions core/src/main/java/org/jruby/RubyStruct.java
Expand Up @@ -547,37 +547,37 @@ public IRubyObject call(IRubyObject obj, boolean recur) {
private IRubyObject inspectStruct(final ThreadContext context, boolean recur) {
Ruby runtime = context.runtime;
RubyArray member = __member__();
ByteList buffer = new ByteList("#<struct ".getBytes());
RubyString buffer = RubyString.newString(getRuntime(), new ByteList("#<struct ".getBytes()));
String cpath = getMetaClass().getRealClass().getName();
char first = cpath.charAt(0);

if (recur || first != '#') {
buffer.append(cpath.getBytes());
buffer.append(' ');
buffer.cat(cpath.getBytes());
buffer.cat(' ');
}

if (recur) {
buffer.append(":...>".getBytes());
return runtime.newString(buffer);
buffer.cat(":...>".getBytes());
return buffer.dup();
}

for (int i = 0,k=member.getLength(); i < k; i++) {
if (i > 0) {
buffer.append(',').append(' ');
buffer.cat(',').cat(' ');
}
RubySymbol slot = (RubySymbol)member.eltInternal(i);
String name = slot.toString();
if (IdUtil.isLocal(name) || IdUtil.isConstant(name)) {
buffer.append(RubyString.objAsString(context, slot).getByteList());
buffer.cat19(RubyString.objAsString(context, slot));
} else {
buffer.append(((RubyString) slot.inspect(context)).getByteList());
buffer.cat19(((RubyString) slot.inspect(context)));
}
buffer.append('=');
buffer.append(inspect(context, values[i]).getByteList());
buffer.cat('=');
buffer.cat19(inspect(context, values[i]));
}

buffer.append('>');
return getRuntime().newString(buffer); // OBJ_INFECT
buffer.cat('>');
return buffer.dup(); // OBJ_INFECT
}

@JRubyMethod(name = {"inspect", "to_s"})
Expand Down

3 comments on commit ad4a92e

@k77ch7
Copy link
Contributor

@k77ch7 k77ch7 commented on ad4a92e Feb 11, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@enebo Your commit is the same as my PR #2579. So you can close it. Thank you.

@enebo
Copy link
Member Author

@enebo enebo commented on ad4a92e Feb 11, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@k77ch7 Sorry I was really confused on this merge. I thought this was already applied.

@k77ch7
Copy link
Contributor

@k77ch7 k77ch7 commented on ad4a92e Feb 11, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I confirmed my PR is closed.

Please sign in to comment.