Ruby Constructs Flashcards

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

Basic File Inclusion

- require

A

Loads a file from $LOAD_PATH or $:.
File type suffix “.rb” is assumed.
Specify directory of the file if it is not in load path.

File is loaded only once for multiple calls to the same file.

xjdhsmdh

hjdjdjdj

djdhdhdh

ydjdjdjfjfjfj

fjjdjfjfkfjxhdnchdmcjf

fjfjfjfjfjfjfjgjfmf

fjfjfjfjfjfj

fjfjfjf

fjfjfjfjfjfjf
fjfjfjf
fjfjfj
fjfjfjfjf
jfjfjfj
cjcjfjfjc
hfjfjfjfjf
fhnfjcjfj

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

Basic File Inclusion

- require_relative

A

Loads specified file relative to file loading the file.
File type suffix “.rb” is assumed.

File is loaded only once for multiple calls to the same file.

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

Basic File Inclusion

- load

A

loads local files like require_relative.

Multiple calls loads the file multiple times.

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

Logic and Include Code

A

require, require_relative and load can be used anywhere in the code.

The code in the loaded file is executed at the point in the script where file is loaded.

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

Nested Inclusions

A

Included files can also use load, require and require_relative.

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