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
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
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
4
Q
How many lines makes a class a behemoth that should probably be broken down into smaller classes?
A
300
5
Q
What happens when a class hits 300 lines?
A
We declare it a behemoth and start looking for ways to refactor
6
Q
How do you set up a singleton in ruby?
A
inside your class:
include Singleton