Method: U::String#initialize

Defined in:
ext/u/rb_u_string.c

#new(string = nil) ⇒ Object

Sets up a U::String wrapping STRING after encoding it as UTF-8 and freezing it.

Parameters:

  • string (String, nil) (defaults to: nil)


161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'ext/u/rb_u_string.c', line 161

static VALUE
rb_u_string_initialize(int argc, VALUE *argv, VALUE self)
{
        VALUE rb;

        rb_scan_args(argc, argv, "01", &rb);
        if (!NIL_P(rb)) {
                StringValue(rb);
                rb_u_string_set_rb(self, rb);
        }

        return Qnil;
}