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
  nil
end

For example:

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

produces:

1cat[4, 5, 6]

Returns:

  • (nil)


7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
# File 'io.c', line 7893

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

    out = (!rb_check_arity(argc, 0, 1) ? rb_stdout : argv[0]);
    rb_io_write(out, self);

    return Qnil;
}