Created
July 15, 2013 03:41
-
-
Save perfectfoolish/5997348 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Machine | |
@@users = {} | |
def initialize(username, password) | |
@username = username | |
@password = password | |
@@users[username] = password | |
@files = {} | |
end | |
def create(filename) | |
time = Time.now | |
@files[filename] = time | |
puts "#{filename} was created by #{@username} at #{time}." | |
end | |
def Machine.get_users | |
@@users | |
end | |
end | |
my_machine = Machine.new("eric", 01234) | |
your_machine = Machine.new("you", 56789) | |
my_machine.create("groceries.txt") | |
your_machine.create("todo.txt") | |
puts "Users: #{Machine.get_users}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment