Open
Conversation
Solar SystemWhat We're Looking For
|
CheezItMan
reviewed
Feb 13, 2018
|
|
||
| def initialize(planets_array) | ||
| @solar_system = planets_array | ||
| @names = [] |
There was a problem hiding this comment.
Does this need to be an instance variable? It looks like it could be used instead as a local variable in create_names.
|
|
||
| # Grab only th names of planets from the planets_array and push it to the new array @names: | ||
| def create_names | ||
| @solar_system.each do |planets_data| |
There was a problem hiding this comment.
If I call create_names twice I'll end up with my list doubled!
| end | ||
| end | ||
|
|
||
| def return_planets_name_variable #how to make this betteR? |
|
|
||
| attr_reader :name, :year_length, :distance_from_the_sun, :planet_type, :interesting_fact1, :number_of_moons, :interesting_fact2 | ||
|
|
||
| def initialize (name, year_length, distance_from_the_sun, planet_type, interesting_fact1, number_of_moons, interesting_fact2) |
There was a problem hiding this comment.
best not to put a space between initialize and the (
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Solar System
Congratulations! You're submitting your assignment.
Comprehension Questions
initializemethod in your class?SolarSystemused anArrayvs aHash.