w2d1 Flashcards

1
Q

What does “serialization” refer to?

A

The conversion of an object into a representation that can be stored on a disk or sent over a network.

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

What is the most common form of serialization on the web?

A

JSON

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

How can a Ruby object be serialized into JSON?

A

Include the ‘json’ gem, then use JSON::parse on the basic class (hash, array, etc.)

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

What is the best way to serialize a custom Ruby class or complex object?

A

Use YAML

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

How do we use YAML to serialize?

A

Require the ‘yaml’ gem, the use Object#to_yaml

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

How do we use YAML to deserialize?

A

Require the ‘yaml’ gem, then use YAML::load(yaml_string)

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