Class: Warchat::Chat::Presence
- Inherits:
-
Object
- Object
- Warchat::Chat::Presence
- Defined in:
- lib/warchat/chat/presence.rb
Instance Attribute Summary collapse
-
#character ⇒ Object
readonly
Returns the value of attribute character.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(response) ⇒ Presence
constructor
A new instance of Presence.
- #offline? ⇒ Boolean
- #type ⇒ Object
Constructor Details
#initialize(response) ⇒ Presence
Returns a new instance of Presence.
7 8 9 10 11 |
# File 'lib/warchat/chat/presence.rb', line 7 def initialize response @type = response["presenceType"]; @character = response["character"]; @name = character["n"]; end |
Instance Attribute Details
#character ⇒ Object (readonly)
Returns the value of attribute character.
5 6 7 |
# File 'lib/warchat/chat/presence.rb', line 5 def character @character end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/warchat/chat/presence.rb', line 5 def name @name end |
Instance Method Details
#offline? ⇒ Boolean
13 14 15 |
# File 'lib/warchat/chat/presence.rb', line 13 def offline? @type and @type.include? 'offline' end |
#type ⇒ Object
17 18 19 20 |
# File 'lib/warchat/chat/presence.rb', line 17 def type return 'unknown' unless @type @type.split('_')[1..-1].join '_' end |