class Kernel Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

exit(p1 = v1)

A

Initiates the termination of the Ruby script by raising the SystemExit exception. This exception may be caught. The optional parameter is used to return a status code to the invoking environment. true and FALSE of status means success and failure respectively. The interpretation of other integer values are system dependent.

begin
  exit
  puts "never get here"
rescue SystemExit
  puts "rescued a SystemExit exception"
end
puts "after begin block"

rescued a SystemExit exception
after begin block

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

at_exit()

A

Converts block to a Proc object (and therefore binds it at the point of call) and registers it for execution when the program exits. If multiple handlers are registered, they are executed in reverse order of registration.

def do_at_exit(str1)
  at_exit { print str1 }
end
at_exit { puts "cruel world" }
do_at_exit("goodbye ")
exit
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

URI(uri)

Public Class Method

A

Returns uri converted to a URI object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

open(path [, mode [, perm]] [, opt]) → io or nil
open(path [, mode [, perm]] [, opt]) {|io| block } → obj
(Public Class Method)

A

Creates an IO object connected to the given stream, file, or subprocess.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

pp(*objs)

Public Class Method

A

prints arguments in pretty form.

pp returns argument(s).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

open_uri_original_open(*args)

Private Class Method

A

Alias for: open

How well did you know this?
1
Not at all
2
3
4
5
Perfectly