Logo
Learn Ruby In Orbit
Menu
Public Planet Blueprints
What's New
Log In
Sign Up
Planet Blueprint #19
Andrew's Code
class Planet def initialize @color = 'yellow' @size = 'xl' @rings = true @atmosphere = 'gaseous' end def is_habitable? false end def species_type "aliens" end def photo_realistic_description desc = [] desc << "The planet has a #{@color} hue." desc << "It is #{@size} in size." desc << "The atmosphere is mainly #{@atmosphere}." desc << (@rings ? "It has rings orbiting around it." : "It doesn't have any rings.") desc << "Is it habitable? #{is_habitable? ? 'Yes' : 'No'}." desc << "Dominant species: #{species_type}." desc.join(' ') end end
Generated Planet