method

new

ruby latest stable - Class: String
new(p1 = v1, p2 = {})
public

Returns a new string object containing a copy of str.

The optional encoding keyword argument specifies the encoding of the new string. If not specified, the encoding of str is used (or ASCII-8BIT, if str is not specified).

The optional capacity keyword argument specifies the size of the internal buffer. This may improve performance, when the string will be concatenated many times (causing many realloc calls).