p

p(obj) â objp(obj1, obj2, ...) â [obj, ...]p() â nil Instance Public methods For each object, directly writes obj.inspect followed by a newline to the program's standard output. S = Struct.new(:name, :state) s = S['dave', 'TX'] p s produces: #<S name="dave", state="TX">

pretty_inspect

pretty_inspect() Instance Public methods returns a pretty printed object as a string.

print

print(obj, ...) â nil Instance Public methods Prints each object in turn to $stdout. If the output field separator ($,) is not nil, its contents will appear between each field. If the output record separator ($\) is not nil, it will be appended to the output. If no arguments are given, prints $_. Objects that aren't strings will be converted by calling their to_s method. print "cat", [1,2,3], 99, "\n" $, = ", " $\ = "\n" print "cat", [1,2,3], 99 produces: cat12399 cat, 1, 2, 3

printf

printf(io, string [, obj ... ]) â nilprintf(string [, obj ... ]) â nil Instance Public methods Equivalent to: io.write(sprintf(string, obj, ...) or $stdout.write(sprintf(string, obj, ...)

proc

proc { |...| block } â a_proc Instance Public methods Equivalent to Proc.new.

putc

putc(int) â int Instance Public methods Equivalent to: $stdout.putc(int) Refer to the documentation for IO#putc for important information regarding multi-byte characters.

puts

puts(obj, ...) â nil Instance Public methods Equivalent to $stdout.puts(obj, ...)

raise

raiseraise(string)raise(exception [, string [, array]]) Instance Public methods With no arguments, raises the exception in $! or raises a RuntimeError if $! is nil. With a single String argument, raises a RuntimeError with the string as a message. Otherwise, the first parameter should be the name of an Exception class (or an object that returns an Exception object when sent an exception message). The optional second parameter sets the message associated with the exception, and the

rand

rand(max=0) â number Instance Public methods If called without an argument, or if max.to_i.abs == 0, rand returns a pseudo-random floating point number between 0.0 and 1.0, including 0.0 and excluding 1.0. rand #=> 0.2725926052826416 When max.abs is greater than or equal to 1, rand returns a pseudo-random integer greater than or equal to 0 and less than max.to_i.abs. rand(100) #=> 12 When max is a Range, rand returns a random number where range.member?(number)

readline

readline(sep=$/) â stringreadline(limit) â stringreadline(sep, limit) â string Instance Public methods Equivalent to Kernel::gets, except readline raises EOFError at end of file.