Class: Planet
- Inherits:
-
Object
- Object
- Planet
- Defined in:
- lib/star_wars_finder/planet.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#population ⇒ Object
readonly
Returns the value of attribute population.
-
#terrain ⇒ Object
readonly
Returns the value of attribute terrain.
Instance Method Summary collapse
-
#initialize(planet) ⇒ Planet
constructor
A new instance of Planet.
Constructor Details
#initialize(planet) ⇒ Planet
Returns a new instance of Planet.
3 4 5 6 7 |
# File 'lib/star_wars_finder/planet.rb', line 3 def initialize(planet) @name = planet["name"] @terrain = planet["terrain"] @population = planet["population"] end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
2 3 4 |
# File 'lib/star_wars_finder/planet.rb', line 2 def name @name end |
#population ⇒ Object (readonly)
Returns the value of attribute population.
2 3 4 |
# File 'lib/star_wars_finder/planet.rb', line 2 def population @population end |
#terrain ⇒ Object (readonly)
Returns the value of attribute terrain.
2 3 4 |
# File 'lib/star_wars_finder/planet.rb', line 2 def terrain @terrain end |