public Method

Object.display(...)

obj.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

Source Code

/*
*  call-seq:
*     obj.display(port=$>)    => nil
*  
*  Prints <i>obj</i> on the given port (default <code>$></code>).
*  Equivalent to:
*     
*     def display(port=$>)
*       port.write self
*     end
*     
*  For example:
*     
*     1.display
*     "cat".display
*     [ 4, 5, 6 ].display
*     puts
*     
*  <em>produces:</em>
*     
*     1cat456
*/

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

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

   rb_io_write(out, self);

   return Qnil;
}
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.