app/services/pandanet/stats.rb
# Parse the response received from the telnet `stats` command.
Parse the response received from the telnet `stats` command.
Parse the response received from the telnet ` stats ` command .
def parse(username, str)
        return nil if !str.present? || str.start_with?("Cannot find player.")
        rating = str.match(/Rating:\s*([1-9][0-9]?[dk])/)[1]
        rank = str.match(/Rank:\s*([1-9][0-9]?[dk])/)[1]
        country = str.match(/Country:\s*([A-Za-z]+)/)[1]
        new(username, rating, rank, country)
      end
def parse ( username , str ) return nil if ! str . present? || str . start_with? ( "Cannot find player." ) rating = str . match ( / Rating: \s *([1-9][0-9]?[dk]) / ) [ 1 ] rank = str . match ( / Rank: \s *([1-9][0-9]?[dk]) / ) [ 1 ] country = str . match ( / Country: \s *([A-Za-z]+) / ) [ 1 ] new ( username , rating , rank , country ) end
Parse the response received from the telnet `stats` command.
Parse the response received from the telnet ` stats ` command .
username
<not_specific>
str
<not_specific>