Skip to content

Instantly share code, notes, and snippets.

@monroemann
Created May 28, 2017 23:29
Show Gist options
  • Save monroemann/7158792e60707ca5a23efce69fa0e8fa to your computer and use it in GitHub Desktop.
Save monroemann/7158792e60707ca5a23efce69fa0e8fa to your computer and use it in GitHub Desktop.
Firehose Class Quiz
class Computer
attr_accessor :make, :model
def initialize(make, model)
@make = make
@model = model
end
def output_computer
puts "Check out the new #{self.make} #{self.model}"
end
end
class Type
def initialize
@computers = []
#BUILD MACS
@computers << Computer.new(:mac, :iBook)
@computers << Computer.new(:mac, :laptop)
@computers << Computer.new(:mac, :iMac)
@computers << Computer.new(:mac, :iMacpro)
#BUILD PCS
@computers << Computer.new(:Dell, :desktop)
@computers << Computer.new(:Dell, :laptop)
@computers << Computer.new(:Microsoft, :surface)
@computers << Computer.new(:Toshiba, :laptop)
end
def shuffle
@computers.shuffle!
end
def deal
@computers.shift
end
def output
@computers.each do |computer|
computer.output_computer
end
end
end
type = Type.new
type.shuffle
type.output
type.output_computer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment