Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement