That method is calling the games= method. It’s not even necessarily setting an attribute. It may be doing so inside the method, or it may not. You may use the setter if you need to do some massaging of the data before the instance variable is set, for instance. Prefixing the setter with self. is required here because without it ruby has no way to know if you’re trying to call a games= or if you are trying to set a local variable named games.
This is directly setting an instance variable rather than calling a method.
This sets up both a getter (self.games) and a setter (self.games=) for the named attribute. If you end up defining either of those in the class you will be overriding the one set by this attr_accessor call. attr_accessor :games ends up defining:
@games = value