class SwTour::Starship

Attributes

crew[RW]
manufacturer[RW]
model[RW]
name[RW]
starship[RW]

Public Class Methods

all() click to toggle source
# File lib/sw_tour/starships.rb, line 32
def self.all
    @@all
end
display_starships() click to toggle source
# File lib/sw_tour/starships.rb, line 15
def self.display_starships
    SwTour::API.get_starships if @@all.empty?
    @@all.each.with_index(1) do |ship, index|
        puts "#{index}. #{ship.name}".colorize(:light_green)
    end
end
new(ship_info) click to toggle source
# File lib/sw_tour/starships.rb, line 7
def initialize(ship_info)
    @name = ship_info["name"]
    @model = ship_info["model"]
    @manufacturer = ship_info["manufacturer"]
    @crew = ship_info["crew"]
    @@all << self
end

Public Instance Methods

starship_info() click to toggle source
# File lib/sw_tour/starships.rb, line 22
def starship_info
    if @@dark_side.include?(self.name)
        puts "\nLooks like you chose the dark side!".colorize(:red)
    else
        puts "\nGreat choice!"
    end
    puts "\nHere's some information about The #{self.name}:" 
    puts "The #{self.name}'s model is #{self.model} and was manufactured by #{self.manufacturer}. The #{self.name} consists of #{self.crew} crew members.".colorize(:light_yellow)
end