Class: Jabber::EntityTime::IqTime

Inherits:
IqQuery show all
Defined in:
lib/xmpp4r/entity_time/iq.rb

Instance Method Summary collapse

Methods inherited from XMPPElement

class_for_name_xmlns, #clone, force_xmlns, force_xmlns?, import, name_xmlns, name_xmlns_for_class, #parent=, #set_xml_lang, #typed_add, #xml_lang, #xml_lang=

Methods inherited from REXML::Element

#==, #delete_elements, #each_elements, #first_element, #first_element_content, #first_element_text, #import, import, #replace_element_content, #replace_element_text, #typed_add

Constructor Details

#initialize(time = nil) ⇒ IqTime

Returns a new instance of IqTime.



13
14
15
16
# File 'lib/xmpp4r/entity_time/iq.rb', line 13

def initialize(time=nil)
  super()
  set_time(time)
end

Instance Method Details

#set_time(time = nil) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/xmpp4r/entity_time/iq.rb', line 18

def set_time(time=nil)
  time ||= Time.now

  tzo = self.add_element('tzo')
  tzo.add_text(time_zone_offset(time))

  utc = self.add_element('utc')
  utc.add_text(utc_time(time))
end