Class: HonStats::Classes::Game

Inherits:
Object
  • Object
show all
Defined in:
lib/honstats/game.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Game

Returns a new instance of Game.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/honstats/game.rb', line 14

def initialize(data)
  @server_id =    HonStats::API.get_data("server_id", data).to_i
  @session =      HonStats::API.get_data("session", data).to_s
  @name =         HonStats::API.get_data("mname", data).to_s
  @class =        HonStats::API.get_data("class", data).to_i
  @private =      HonStats::API.get_data("private", data).to_i
  @max_players =  (HonStats::API.get_data("max_players", data).to_i * 2)
  @tier =         HonStats::API.get_data("tier", data).to_i
  @official =     HonStats::API.get_data("officl", data).to_i
  @ip =           HonStats::API.get_data("ip", data).to_s
  @port =         HonStats::API.get_data("port", data).to_i
  @players =      HonStats::API.get_data("num_conn", data).to_i
  @state =        HonStats::API.get_data("c_state", data).to_i
  @last_update =  Time.parse(HonStats::API.get_data("last_upd", data).to_s)
  @location =     HonStats::API.get_data("location", data).to_s
  @modes =        Modes.new(data)
end

Instance Attribute Details

#classObject (readonly)

Returns the value of attribute class.



7
8
9
# File 'lib/honstats/game.rb', line 7

def class
  @class
end

#ipObject (readonly)

Returns the value of attribute ip.



7
8
9
# File 'lib/honstats/game.rb', line 7

def ip
  @ip
end

#last_updateObject (readonly)

Returns the value of attribute last_update.



7
8
9
# File 'lib/honstats/game.rb', line 7

def last_update
  @last_update
end

#locationObject (readonly)

Returns the value of attribute location.



7
8
9
# File 'lib/honstats/game.rb', line 7

def location
  @location
end

#max_playersObject (readonly)

Returns the value of attribute max_players.



7
8
9
# File 'lib/honstats/game.rb', line 7

def max_players
  @max_players
end

#modesObject (readonly)

Returns the value of attribute modes.



7
8
9
# File 'lib/honstats/game.rb', line 7

def modes
  @modes
end

#nameObject (readonly) Also known as: to_s

Returns the value of attribute name.



7
8
9
# File 'lib/honstats/game.rb', line 7

def name
  @name
end

#officialObject (readonly)

Returns the value of attribute official.



7
8
9
# File 'lib/honstats/game.rb', line 7

def official
  @official
end

#playersObject (readonly)

Returns the value of attribute players.



7
8
9
# File 'lib/honstats/game.rb', line 7

def players
  @players
end

#portObject (readonly)

Returns the value of attribute port.



7
8
9
# File 'lib/honstats/game.rb', line 7

def port
  @port
end

#privateObject (readonly)

Returns the value of attribute private.



7
8
9
# File 'lib/honstats/game.rb', line 7

def private
  @private
end

#server_idObject (readonly) Also known as: to_i

Returns the value of attribute server_id.



7
8
9
# File 'lib/honstats/game.rb', line 7

def server_id
  @server_id
end

#sessionObject (readonly)

Returns the value of attribute session.



7
8
9
# File 'lib/honstats/game.rb', line 7

def session
  @session
end

#stateObject (readonly)

Returns the value of attribute state.



7
8
9
# File 'lib/honstats/game.rb', line 7

def state
  @state
end

#tierObject (readonly)

Returns the value of attribute tier.



7
8
9
# File 'lib/honstats/game.rb', line 7

def tier
  @tier
end