-
Notifications
You must be signed in to change notification settings - Fork 48
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
Sockets-Chantal #47
base: master
Are you sure you want to change the base?
Sockets-Chantal #47
Conversation
still working on wave 3
wave 3 list planets, planet details working.
wave 3
Solar SystemWhat We're Looking For
Good job overall. Your code is clean and well-organized, and you definitely hit the project requirements. However, I am concerned that you may have missed learning goals around working with git, and around using helper methods with classes. Please review these two topics, and feel free to reach out if you have questions. |
def add_new_planet | ||
puts "What is the name of the planet?" | ||
name = gets.chomp.capitalize | ||
puts "What color is the planet?" |
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.
I like that you broke this out into a separate method - good organization!
elsif input == "add planet" | ||
planet_new = add_new_planet | ||
solar_system.add_planet(add_new_planet) | ||
else |
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.
On line 30 you call add_new_planet
and assign it to the planet_new
variable. Then on line 31, instead of using planet_new
, you call add_new_planet
again! That means the user has to enter all this info twice.
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.
THANK YOU for pointing that out. that was driving me bananas i couldnt figure out why it asked twice.
|
||
def name | ||
return @name | ||
end |
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.
You should use the helper methods (attr_reader
, attr_writer
, attr_accessor
) to generate these getter and setter methods.
def find_planet_by_name(planet_name) | ||
@planets.each do |planet| | ||
if planet_name.upcase == planet.name.upcase | ||
return planet |
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.
Is there an enumerable method you could use for this?
Solar System
Congratulations! You're submitting your assignment.
Comprehension Questions
initialize
method run? What does it do?Hash
instead of an instance of a class?SolarSystem
class used aHash
instead of anArray
to store the list of planets?require
statements? Which files neededrequire
s, and which did not? What is the pattern?