Class: HonStats::Classes::Game
- Inherits:
-
Object
- Object
- HonStats::Classes::Game
- Defined in:
- lib/honstats/game.rb
Instance Attribute Summary collapse
-
#class ⇒ Object
readonly
Returns the value of attribute class.
-
#ip ⇒ Object
readonly
Returns the value of attribute ip.
-
#last_update ⇒ Object
readonly
Returns the value of attribute last_update.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#max_players ⇒ Object
readonly
Returns the value of attribute max_players.
-
#modes ⇒ Object
readonly
Returns the value of attribute modes.
-
#name ⇒ Object
(also: #to_s)
readonly
Returns the value of attribute name.
-
#official ⇒ Object
readonly
Returns the value of attribute official.
-
#players ⇒ Object
readonly
Returns the value of attribute players.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#private ⇒ Object
readonly
Returns the value of attribute private.
-
#server_id ⇒ Object
(also: #to_i)
readonly
Returns the value of attribute server_id.
-
#session ⇒ Object
readonly
Returns the value of attribute session.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#tier ⇒ Object
readonly
Returns the value of attribute tier.
Instance Method Summary collapse
-
#initialize(data) ⇒ Game
constructor
A new instance of Game.
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
#class ⇒ Object (readonly)
Returns the value of attribute class.
7 8 9 |
# File 'lib/honstats/game.rb', line 7 def class @class end |
#ip ⇒ Object (readonly)
Returns the value of attribute ip.
7 8 9 |
# File 'lib/honstats/game.rb', line 7 def ip @ip end |
#last_update ⇒ Object (readonly)
Returns the value of attribute last_update.
7 8 9 |
# File 'lib/honstats/game.rb', line 7 def last_update @last_update end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
7 8 9 |
# File 'lib/honstats/game.rb', line 7 def location @location end |
#max_players ⇒ Object (readonly)
Returns the value of attribute max_players.
7 8 9 |
# File 'lib/honstats/game.rb', line 7 def max_players @max_players end |
#modes ⇒ Object (readonly)
Returns the value of attribute modes.
7 8 9 |
# File 'lib/honstats/game.rb', line 7 def modes @modes end |
#name ⇒ Object (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 |
#official ⇒ Object (readonly)
Returns the value of attribute official.
7 8 9 |
# File 'lib/honstats/game.rb', line 7 def official @official end |
#players ⇒ Object (readonly)
Returns the value of attribute players.
7 8 9 |
# File 'lib/honstats/game.rb', line 7 def players @players end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
7 8 9 |
# File 'lib/honstats/game.rb', line 7 def port @port end |
#private ⇒ Object (readonly)
Returns the value of attribute private.
7 8 9 |
# File 'lib/honstats/game.rb', line 7 def private @private end |
#server_id ⇒ Object (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 |
#session ⇒ Object (readonly)
Returns the value of attribute session.
7 8 9 |
# File 'lib/honstats/game.rb', line 7 def session @session end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
7 8 9 |
# File 'lib/honstats/game.rb', line 7 def state @state end |
#tier ⇒ Object (readonly)
Returns the value of attribute tier.
7 8 9 |
# File 'lib/honstats/game.rb', line 7 def tier @tier end |