-
-
Notifications
You must be signed in to change notification settings - Fork 922
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,2 @@ | ||
fails:StringIO#<< when passed [Object] returns self | ||
fails:StringIO#<< when passed [Object] writes the passed argument onto self | ||
fails:StringIO#<< when passed [Object] writes the passed argument at the current position | ||
fails:StringIO#<< when passed [Object] pads self with \000 when the current position is after the end | ||
fails:StringIO#<< when passed [Object] taints self's String when the passed argument is tainted | ||
fails:StringIO#<< when passed [Object] does not taint self when the passed argument is tainted | ||
fails:StringIO#<< when passed [Object] updates self's position | ||
fails:StringIO#<< when passed [Object] tries to convert the passed argument to a String using #to_s |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,7 @@ | ||
fails:StringIO#print prints $_ when passed no arguments | ||
fails:StringIO#print prints the passed arguments to self | ||
fails:StringIO#print tries to convert the passed Object to a String using #to_s | ||
fails:StringIO#print returns nil | ||
fails:StringIO#print pads self with \000 when the current position is after the end | ||
fails:StringIO#print honors the output record separator global | ||
fails:StringIO#print updates the current position | ||
fails:StringIO#print correctly updates the current position when honoring the output record separator global | ||
fails:StringIO#print when in append mode appends the passed argument to the end of self | ||
fails:StringIO#print when in append mode correctly updates self's position |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1 @@ | ||
fails:StringIO#printf returns nil | ||
fails:StringIO#printf pads self with \000 when the current position is after the end | ||
fails:StringIO#printf performs format conversion | ||
fails:StringIO#printf updates the current position |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2213,4 +2213,22 @@ public static ByteList swapcase(RubyString string) { | |
} | ||
} | ||
|
||
@CoreMethod(names = "_set_num_bytes", required = 1) | ||
public abstract static class SetNumBytesNode extends CoreMethodNode { | ||
|
||
public SetNumBytesNode(RubyContext context, SourceSection sourceSection) { | ||
super(context, sourceSection); | ||
} | ||
|
||
public SetNumBytesNode(SetNumBytesNode prev) { | ||
super(prev); | ||
} | ||
|
||
@Specialization | ||
public RubyString setNumBytes(RubyString string, int count) { | ||
string.getByteList().view(0, count); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
chrisseaton
Author
Contributor
|
||
return string; | ||
} | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -199,4 +199,16 @@ def [](index) | |
@array[index] | ||
end | ||
end | ||
end | ||
end | ||
|
||
class String | ||
|
||
def modify! | ||
This comment has been minimized.
Sorry, something went wrong.
nirvdrum
Contributor
|
||
# TODO CS 14-Mar-15 what does this do? | ||
end | ||
|
||
def num_bytes=(count) | ||
_set_num_bytes count | ||
end | ||
|
||
end |
7 comments
on commit 4feca49
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nirvdrum check this is compatible with the way you are tackling String
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had been avoiding these methods. But if they work, great.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And unrelated, but I think this is first synthetic method we've added to String, so we'll want to keep track of that for whatever cleanup @eregon has in mind.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the indirection with num_bytes/_set_num_bytes? Is it used with an explicit receiver?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought a name like _set_num_bytes
made it clearer it was synthetic - the leading underscore. If I implemented num_bytes=
directly in Java and not in a shims file I think we'd forget.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if you annotate the CoreMethod with @RubiniusOnly
? I think it would be clear while keeping things simple.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah sorry I forgot about @RubiniusOnly
- I should have used that.
This looks funny, but maybe it's just ByteList API?