#7 - Instantiation Nation: error undefined method `files' for #<Context::Computer:0x00000001e28eb0>


#1




error undefined method `files' for #<Context::computer:0x00000001e28eb0>


class Computer
    @@users = {}
    def initialize(username, password)
        @username = username
        @Password = password
        @files = 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
        return @@users
    end
end
my_computer = Computer.new("DanDan", 12345)


#2

Did you mean to write, @password?

@files = {}

#3

Good eye! Yep, that did the trick.

Thanks Roy!

Dan


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.