format

format(format_string [, arguments...] ) â string Instance Public methods Returns the string resulting from applying format_string to any additional arguments. Within the format string, any characters other than format sequences are copied to the result. The syntax of a format sequence is follows. %[flags][width][.precision]type A format sequence consists of a percent sign, followed by optional flags, width, and precision indicators, then terminated with a field type character.

gem_original_require

gem_original_require(path) Instance Public methods The Kernel#require from before RubyGems was loaded. require

gets

gets(sep=$/) â string or nilgets(limit) â string or nilgets(sep,limit) â string or nil Instance Public methods Returns (and assigns to $_) the next line from the list of files in ARGV (or $*), or from standard input if no files are present on the command line. Returns nil at end of file. The optional argument specifies the record separator. The separator is included with the contents of each record. A separator of nil reads the entire contents, and a zero-length separator r

global_variables

global_variables â array Instance Public methods Returns an array of the names of global variables. global_variables.grep /std/ #=> [:$stdin, :$stdout, :$stderr]

gsub

gsub(pattern, replacement) â stringgsub(pattern) {|...| block } â string Instance Public methods Equivalent to $_.gsub..., except that $_ receives the modified result. Available only when -p/-n command line option specified.

iterator?

iterator? â true or false Instance Public methods Returns true if yield would execute a block in the current context. The iterator? form is mildly deprecated. def try if block_given? yield else "no block" end end try #=> "no block" try { "hello" } #=> "hello" try do "hello" end #=> "hello"

lambda

lambda { |...| block } â a_proc Instance Public methods Equivalent to Proc.new, except the resulting Proc objects check the number of parameters passed when called.

load

load(filename, wrap=false) â true Instance Public methods Loads and executes the Ruby program in the file filename. If the filename does not resolve to an absolute path, the file is searched for in the library directories listed in $:. If the optional wrap parameter is true, the loaded script will be executed under an anonymous module, protecting the calling program's global namespace. In no circumstance will any local variables in the loaded file be propagated to the loading en

local_variables

local_variables â array Instance Public methods Returns the names of the current local variables. fred = 1 for i in 1..10 # ... end local_variables #=> [:fred, :i]

loop

loop { block }loop â an_enumerator Instance Public methods Repeatedly executes the block. If no block is given, an enumerator is returned instead. loop do print "Input: " line = gets break if !line or line =~ /^qQ/ # ... end StopIteration raised in the block breaks the loop.