Class: Del::User

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

Overview

An XMPP user.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(jid, attributes) ⇒ User

Returns a new instance of User.



8
9
10
11
# File 'lib/del/user.rb', line 8

def initialize(jid, attributes)
  @jid = jid
  @attributes = attributes || {}
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



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

def attributes
  @attributes
end

#jidObject (readonly)

Returns the value of attribute jid.



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

def jid
  @jid
end

Class Method Details

.map_from(attributes) ⇒ Object



21
22
23
24
25
# File 'lib/del/user.rb', line 21

def self.map_from(attributes)
  return nil if attributes.nil?

  new(attributes['jid'], attributes)
end

Instance Method Details

#mention_nameObject



13
14
15
# File 'lib/del/user.rb', line 13

def mention_name
  attributes[:mention_name]
end

#to_sObject



17
18
19
# File 'lib/del/user.rb', line 17

def to_s
  YAML.dump(attributes)
end