Class: Planet

Inherits:
Object
  • Object
show all
Defined in:
lib/star_wars_finder/planet.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#nameObject (readonly)

Returns the value of attribute name.



2
3
4
# File 'lib/star_wars_finder/planet.rb', line 2

def name
  @name
end

#populationObject (readonly)

Returns the value of attribute population.



2
3
4
# File 'lib/star_wars_finder/planet.rb', line 2

def population
  @population
end

#terrainObject (readonly)

Returns the value of attribute terrain.



2
3
4
# File 'lib/star_wars_finder/planet.rb', line 2

def terrain
  @terrain
end