Class: SpaceshipMissionSimulator::Planet
- Inherits:
-
Struct
- Object
- Struct
- SpaceshipMissionSimulator::Planet
- Defined in:
- lib/spaceship_mission_simulator/planet.rb
Instance Attribute Summary collapse
-
#gravity ⇒ Object
Returns the value of attribute gravity.
-
#key ⇒ Object
Returns the value of attribute key.
-
#name ⇒ Object
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#gravity ⇒ Object
Returns the value of attribute gravity
6 7 8 |
# File 'lib/spaceship_mission_simulator/planet.rb', line 6 def gravity @gravity end |
#key ⇒ Object
Returns the value of attribute key
6 7 8 |
# File 'lib/spaceship_mission_simulator/planet.rb', line 6 def key @key end |
#name ⇒ Object
Returns the value of attribute name
6 7 8 |
# File 'lib/spaceship_mission_simulator/planet.rb', line 6 def name @name end |
Class Method Details
.known_gravity?(gravity) ⇒ Boolean
7 8 9 |
# File 'lib/spaceship_mission_simulator/planet.rb', line 7 def self.known_gravity?(gravity) AVAILABLE_PLANETS.value? gravity end |
Instance Method Details
#fill_up_data ⇒ Object
11 12 13 14 15 16 |
# File 'lib/spaceship_mission_simulator/planet.rb', line 11 def fill_up_data tap do |planet| planet.key = AVAILABLE_PLANETS.key gravity planet.name = key.to_s.capitalize end end |