D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
ARGF
/
Filename :
puts-i.ri
back
Copy
U:RDoc::AnyMethod[iI" puts:ETI"ARGF#puts;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [ I"OWrites the given +objects+ to the stream, which must be open for writing; ;TI"returns +nil+.\ ;TI"TWrites a newline after each that does not already end with a newline sequence. ;TI"4If called without arguments, writes a newline. ;TI"(See {Line IO}[rdoc-ref:IO@Line+IO].;To:RDoc::Markup::BlankLine o; ; [I"CNote that each added newline is the character <tt>"\n"<//tt>, ;TI"4not the output record separator (<tt>$\\</tt>).;T@o; ; [I"Treatment for each object:;T@o:RDoc::Markup::List: @type:BULLET:@items[o:RDoc::Markup::ListItem:@label0; [o; ; [I"String: writes the string.;To;;0; [o; ; [I";Neither string nor array: writes <tt>object.to_s</tt>.;To;;0; [o; ; [I"CArray: writes each element of the array; arrays may be nested.;T@o; ; [I"@To keep these examples brief, we define this helper method:;T@o:RDoc::Markup::Verbatim; [I"def show(*objects) ;TI" # Puts objects to file. ;TI"# f = File.new('t.tmp', 'w+') ;TI" f.puts(objects) ;TI" # Return file content. ;TI" f.rewind ;TI" p f.read ;TI" f.close ;TI" end ;TI" ;TI"!# Strings without newlines. ;TI":show('foo', 'bar', 'baz') # => "foo\nbar\nbaz\n" ;TI"$# Strings, some with newlines. ;TI":show("foo\n", 'bar', "baz\n") # => "foo\nbar\nbaz\n" ;TI" ;TI"## Neither strings nor arrays: ;TI"8show(0, 0.0, Rational(0, 1), Complex(9, 0), :zero) ;TI"&# => "0\n0.0\n0/1\n9+0i\nzero\n" ;TI" ;TI"# Array of strings. ;TI":show(['foo', "bar\n", 'baz']) # => "foo\nbar\nbaz\n" ;TI"# Nested arrays. ;TI"<show([[[0, 1], 2, 3], 4, 5]) # => "0\n1\n2\n3\n4\n5\n";T:@format0: @fileI" io.c;T:0@omit_headings_from_table_of_contents_below0I"puts(*objects) -> nil ;T0[ I"(*args);T@GFI" ARGF;TcRDoc::NormalClass00