Class: WeewarAI::Player
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #current? ⇒ Boolean
-
#initialize(h) ⇒ Player
constructor
A new instance of Player.
Constructor Details
#initialize(h) ⇒ Player
Returns a new instance of Player.
15 16 17 18 |
# File 'lib/weewar-ai/player.rb', line 15 def initialize( h ) @name = h[ 'content' ] @current = ( h[ 'current' ] == 'true' ) end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/weewar-ai/player.rb', line 3 def name @name end |
Class Method Details
.[](id) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/weewar-ai/player.rb', line 5 def self.[]( id ) #id = id.to_i #new( #XmlSimple.xml_in( #WeewarAI::API.get( "/api1/gamestate/#{id}" ), #{ 'ForceArray' => false, } #) #) end |
Instance Method Details
#current? ⇒ Boolean
20 21 22 |
# File 'lib/weewar-ai/player.rb', line 20 def current? @current end |