-class BasicPlayer
- # Idetifier of the player in the rating system
- attr_accessor :id
-
- # Name of the player
- attr_accessor :name
-
- # Password of the player, which does not include a trip
- attr_accessor :password
-
- # Score in the rating sysem
- attr_accessor :rate
-
- # Group in the rating system
- attr_accessor :rating_group
-
- # Last timestamp when the rate was modified
- attr_accessor :modified_at
-
-
-
- def initialize
- @name = nil
- @password = nil
- end
-
- def modified_at
- @modified_at || Time.now
- end
-
- def rate=(new_rate)
- if @rate != new_rate
- @rate = new_rate
- @modified_at = Time.now
- end
- end
-
- def rated?
- @id != nil
- end
-
- def simple_id
- if @trip
- simple_name = @name.gsub(/@.*?$/, '')
- "%s+%s" % [simple_name, @trip[0..8]]
- else
- @name
- end
- end
-
- ##
- # Parses str in the LOGIN command, sets up @id and @trip
- #
- def set_password(str)
- if str && !str.empty?
- @password = str.strip
- @id = "%s+%s" % [@name, Digest::MD5.hexdigest(@password)]
- else
- @id = @password = nil
- end
- end
-end
-
-