Skip to content

Instantly share code, notes, and snippets.

@mattmawhinney
Created June 18, 2013 21:27
Show Gist options
  • Save mattmawhinney/5809589 to your computer and use it in GitHub Desktop.
Save mattmawhinney/5809589 to your computer and use it in GitHub Desktop.
# Code from Codeacademy working on using class variables and class methods
class Computer
@@users = {}
def initialize(username, password)
@username = username
@password = password
@files = {}
@@users[username] = password
end
def create(filename)
time = Time.now
@files[filename] = time
puts "#{filename} was created by #{@username} at #{time}."
end
def Computer.get_users
@@users
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment