-
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 - Kate N #29
base: master
Are you sure you want to change the base?
Sockets - Kate N #29
Conversation
Solar SystemWhat We're Looking For
This is a good start. In general your code is well-organized, and it's clear to me that the core learning goal of creating and working with classes has been met. However, there are a number of small things that definitely need to be fixed around your git habits and the way you're working with files. This is an important part of our curriculum, and will be key on pair projects going forward. If there's still some confusion, please don't hesitate to reach out to one of us, and we'd be happy to help you debug your process. Other than that, I'm happy with what I see here. Keep up the hard work! |
|
||
camazotz = Planet.new(“Camazotz”, “red”, 68.9, 22.777, “Ruled by a disembodied brain”) | ||
ixchel = Planet.new(“Ixchel”, “pink”, 49, 10.8E9, “Inhabited by sightless creatures”) | ||
uriel = Planet.new(“Uriel”, “blue”, 10, 411.5E1, “Lots of extremely tall mountains”) |
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.
Your main.rb
file had a bunch of weird syntax errors. It somehow ended up with a bunch of angle quotes (“”
) instead of straight quotes ("
), which very much confuses the Ruby interpreter. You can see here that the syntax highlighting doesn't understand what's going on.
The only way I've seen this happen is via saving code in a Google doc or word doc or similar application, and then copy/pasting it into your editor directly.
This problem was relatively easy to fix, but isn't one I would expect you to be hitting. I have two asks for you here:
- Make sure you run your code before submitting it
- If this comes up and you're not sure how it happened, come find an instructor
until directions == "exit" | ||
puts "Please enter list planets to see all the planets, planet details to learn more about each planet, or add planet to enter a new planet. | ||
directions = gets.chomp.downcase | ||
if directions == "list planets"EXIT |
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.
More syntax errors: missing and end-quote on line 19, and an extra EXIT
at the end of line 21.
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've broken this functionality out as a separate method, and that you've kept it here in main.rb
with the rest of the code to interact with the user. Good organization!
|
||
def find_planet_by_name(find_planet) | ||
repeat_name = @planets.find { |planet_name| planet_name.name == find_planet.capitalize } | ||
return repeat_name |
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'm not convinced by these variable names. What about something like this:
def find_planet_by_name(name)
found_planet = @planets.find { |planet| planet.name == name.capitalize }
return found_planet
end
I should say that when I cleaned up the problems with the quotes and the extra |
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?