Class: Okayu::PlayerStatus
- Inherits:
-
Object
- Object
- Okayu::PlayerStatus
- Defined in:
- lib/player_status.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(xml_str) ⇒ PlayerStatus
constructor
A new instance of PlayerStatus.
- #method_missing(m, *args) ⇒ Object
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
#data ⇒ Object (readonly)
Returns the value of attribute data.
6 7 8 |
# File 'lib/player_status.rb', line 6 def data @data end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
6 7 8 |
# File 'lib/player_status.rb', line 6 def status @status end |