Skip to content
Browse files

Merge pull request #758 from kachick/implement-string-prepend

Implement String#prepend
  • Loading branch information
alex committed Jun 23, 2013
2 parents 196c6f8 + 7930ab2 commit 73024e1c885d2d4434d0b3f086eca81b2779f9af
Showing with 7 additions and 5 deletions.
  1. +0 −5 spec/tags/core/string/prepend_tags.txt
  2. +7 −0 topaz/objects/
@@ -1,6 +1 @@
fails:String#prepend prepends the given argument to self and returns self
fails:String#prepend converts the given argument to a String using to_str
fails:String#prepend raises a TypeError if the given argument can't be converted to a String
fails:String#prepend raises a RuntimeError when self if frozen
fails:String#prepend works when given a subclass instance
fails:String#prepend taints self if other is tainted
@@ -1125,6 +1125,13 @@ def method_insert(self, space, index, other):
self.strategy.insert(self.str_storage, index, other)
return self

@classdef.method("prepend", other="str")
def method_prepend(self, space, other):
self.strategy.to_mutable(space, self)
self.strategy.insert(self.str_storage, 0, other)
return self

def method_strip_i(self, space):

0 comments on commit 73024e1

Please sign in to comment.