-
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
Solar_System #51
base: master
Are you sure you want to change the base?
Solar_System #51
Conversation
Solar SystemWhat We're Looking For
|
require "pry" | ||
|
||
#storing the planets and adding them to solar_system WomenofCode | ||
def main |
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.
This method is just begging to be broken up into smaller methods 🙏
return planet | ||
end | ||
end | ||
puts "That planet is not in our Solar System. Please re-enter your reponse" |
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.
This method should not use puts
. Instead just return nil
|
||
def find_planet_by_name(found_planet) | ||
|
||
@planets.each do |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.
You could also do this with:
return @planets.find do |planet|
planet.name.downcase == found_planet.downcase
end
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?