You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: user.rb
    path of file: ./repos/Sitepoint-source/Dota_on_Rails/app/models
    
    the code of the file until where you have to start completion: # == Schema Information
#
# Table name: users
#
#  id          :integer          not null, primary key
#  nickname    :string
#  uid         :string
#  avatar_url  :string
#  profile_url :string
#  created_at  :datetime         not null
#  updated_at  :datetime         not null
#

require './lib/utils'

class User < ActiveRecord::Base
  include Utils
  has_many :matches

  class <
    
  def load_matches!(count)
    matches_arr = Dota.api.matches(player_id: self.uid, limit: count)
    if matches_arr && matches_arr.any?
      matches_arr.each do |match|
        unless self.matches.where(uid: match.id).any?
          match_info = nil
          loop do
            # Sometimes Steam API returns nothing in response
            match_info = Dota.api.matches(match.id)
            break if match_info && match_info.id
          end
          new_match = self.matches.create({
                                            uid: match.id,
                                            winner: match_info.winner.to_s.titleize,
                                            first_blood: parse_duration(match_info.first_blood),
                                            started_at: match_info.starts_at,
                                            mode: match_info.mode,
                                            cluster: match_info.cluster,
                                            duration: parse_duration(match_info.duration),
                                            match_type: match_info.type,
                                            likes: match_info.positive_votes,
                                            dislikes: match_info.negative_votes,
                                            towers_status: {
                                              radiant: parse_buildings(match_info.radiant.tower_status),
                                              dire: parse_buildings(match_info.dire.tower_status)
                                            },
                                            barracks_status: {
                                              radiant: parse_buildings(match_info.radiant.barracks_status),
                                              dire: parse_buildings(match_info.dire.barracks_status)
                                            }
                                          })
          new_match.load_players!(match_info.radiant, match_info.dire)
        end
      end