U
Une bévue
i've allready extendy String class by a #copy(n) like that :
class String
def copy(n)
out=""
(1..n).each {|i| out+=self}
return out
end
end
however i'd like to extend also String with a #copy!(n) (in place which
would work like that :
"*".copy!(4)
# => "****"
the prob is to affect self ???
class String
def copy(n)
out=""
(1..n).each {|i| out+=self}
return out
end
end
however i'd like to extend also String with a #copy!(n) (in place which
would work like that :
"*".copy!(4)
# => "****"
the prob is to affect self ???