-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
airport challenge #2516
base: main
Are you sure you want to change the base?
airport challenge #2516
Conversation
require_relative 'plane' | ||
|
||
class Airport | ||
DEFAULT_CAPACITY = 3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good use of a constant variable - omits the risk of using magic numbers
|
||
def initialize(capacity = DEFAULT_CAPACITY) | ||
@planes_at_airport = [] | ||
@capacity = capacity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@capacity = capacity
can be changed to @capacity
@capacity = capacity | ||
end | ||
|
||
def land(_plane) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_plane
argument is not used within method, potentially can be omitted with caution, (I think).
end | ||
|
||
def storm? | ||
rand(10) >= 8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good way to make weather sunny most of the time
DEFAULT_CAPACITY = 3 | ||
|
||
# makes capacity variable | ||
attr_accessor :capacity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
attr_accessor
can be changed to attr_reader
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As an overview, the code is really neat. Everything is described well & a lot of the code made sense to me as to what it did. There are some comments that can be omitted but we spoke about that in person. There are some areas where there are opportunities to refactor your code which I've pointed out in the comments. Overall the code made a lot of sense for me to read.
Laura Voss
Please write your full name here to make it easier to find your pull request.
User stories
Please list which user stories you've implemented (delete the ones that don't apply).
README checklist
Does your README contains instructions for
Here is a pill that can help you write a great README!