Method: Object#display

Defined in:
io.c

#display(port = $>) ⇒ nil

Prints obj on the given port (default $>). Equivalent to:

def display(port=$>)
  port.write self
end

For example:

1.display
"cat".display
[ 4, 5, 6 ].display
puts

produces:

1cat456

Returns:

  • (nil)


7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
# File 'io.c', line 7236

static VALUE
rb_obj_display(int argc, VALUE *argv, VALUE self)
{
    VALUE out;

    if (argc == 0) {
  out = rb_stdout;
    }
    else {
  rb_scan_args(argc, argv, "01", &out);
    }
    rb_io_write(out, self);

    return Qnil;
}