Class: Okayu::PlayerStatus

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml_str) ⇒ PlayerStatus

Returns a new instance of PlayerStatus.



7
8
9
10
# File 'lib/player_status.rb', line 7

def initialize xml_str
  @data = Nokogiri::XML(xml_str)
  @status = @data.root.attribute('status').to_s == 'ok'
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args) ⇒ Object



12
13
14
# File 'lib/player_status.rb', line 12

def method_missing(m, *args)
  @data.css(m.to_s).text
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



6
7
8
# File 'lib/player_status.rb', line 6

def data
  @data
end

#statusObject (readonly)

Returns the value of attribute status.



6
7
8
# File 'lib/player_status.rb', line 6

def status
  @status
end