End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Object#display
obj.display(port=$>) → nil
io.c
View on GitHub ↗
static VALUE
rb_obj_display(int argc, VALUE *argv, VALUE self)
{
VALUE out;
out = (!rb_check_arity(argc, 0, 1) ? rb_ractor_stdout() : argv[0]);
rb_io_write(out, self);
return Qnil;
}
Prints obj on the given port (default $>). Equivalent to:
Example
def display(port=$>) port.write self nil end
For example:
Example
1.display "cat".display [ 4, 5, 6 ].display puts
produces:
1cat[4, 5, 6]