w2d1 Flashcards

1
Q

How do you pass parameters from a child class’s initialize up to the parent’s initialize?

A

super

this magically passes parameters up

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

What’s the full way to wrap code that might throw an exception and that we want to do over and over until it works?

A
begin
retry
raise
rescue
ensure
end
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Why can you use a retry statement within a method without using begin/end?

A

method and class definitions are implicitly wrapped in begin/end blocks

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

How many lines makes a class a behemoth that should probably be broken down into smaller classes?

A

300

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

What happens when a class hits 300 lines?

A

We declare it a behemoth and start looking for ways to refactor

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

How do you set up a singleton in ruby?

A

inside your class:

include Singleton

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