Class: Jabber::VCard

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

Overview

The VCard class holds the parsed VCard data from the Jabber service.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#emailObject

Returns the value of attribute email.



13
14
15
# File 'lib/jabber4r/vcard.rb', line 13

def email
  @email
end

#familyObject

Returns the value of attribute family.



13
14
15
# File 'lib/jabber4r/vcard.rb', line 13

def family
  @family
end

#givenObject

Returns the value of attribute given.



13
14
15
# File 'lib/jabber4r/vcard.rb', line 13

def given
  @given
end

#middleObject

Returns the value of attribute middle.



13
14
15
# File 'lib/jabber4r/vcard.rb', line 13

def middle
  @middle
end

#nicknameObject

Returns the value of attribute nickname.



13
14
15
# File 'lib/jabber4r/vcard.rb', line 13

def nickname
  @nickname
end

Class Method Details

.from_element(je) ⇒ Object

Factory to create the VCard from the ParsedXMLElement

je
ParsedXMLElement

The VCard as an xml element.

return
Jabber::VCard

The newly created VCard.



21
22
23
24
25
26
27
28
29
30
# File 'lib/jabber4r/vcard.rb', line 21

def VCard.from_element(je)
  card = VCard.new
  return card unless je
  card.given = je.N.GIVEN.element_data
  card.family = je.N.FAMILY.element_data
  card.middle = je.N.MIDDLE.element_data
  card.email = je.EMAIL.element_data
  card.nickname = je.NICKNAME.element_data
  return card
end

Instance Method Details

#to_sObject

Dumps the attributes of the VCard

return
String

The VCard as a string. #



36
37
38
# File 'lib/jabber4r/vcard.rb', line 36

def to_s
  "VCARD: [first=#{@given} last=#{@family} nick=#{@nickname} email=#{@email}]"
end