Class: AgentXmpp::Xmpp::Stanza
- Inherits:
-
Element
- Object
- REXML::Element
- Element
- AgentXmpp::Xmpp::Stanza
- Defined in:
- lib/agent_xmpp/xmpp/stanza.rb
Overview
Class Method Summary collapse
-
.answer(stanza, import = true) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….……
Instance Method Summary collapse
-
#answer(import = true) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….……
-
#error ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….……
-
#from ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….……
-
#from=(v) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….……
-
#id ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….……
-
#id=(v) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….……
-
#normalize ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….……
-
#to ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….……
-
#to=(v) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….……
-
#type ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….……
-
#type=(t) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….……
Methods inherited from Element
#<<, class_for_name_xmlns, #clone, import, #initialize, name_xmlns, name_xmlns_for_class, #parent=, #set_xml_lang, #typed_add, #xml_lang, #xml_lang=, xmpp_attribute, xmpp_child
Methods inherited from REXML::Element
#delete_elements, #first_element, #first_element_text, #import, import, #replace_element_text, #typed_add
Constructor Details
This class inherits a constructor from AgentXmpp::Xmpp::Element
Class Method Details
.answer(stanza, import = true) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….……
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/agent_xmpp/xmpp/stanza.rb', line 34 def Stanza.answer(stanza, import=true) x = stanza.class.new if import x.import(stanza) end x.from = stanza.to x.to = stanza.from x.id = stanza.id x end |
Instance Method Details
#answer(import = true) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….……
51 52 53 |
# File 'lib/agent_xmpp/xmpp/stanza.rb', line 51 def answer(import=true) Stanza.answer(self, import) end |
#error ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….……
46 47 48 |
# File 'lib/agent_xmpp/xmpp/stanza.rb', line 46 def error first_element('error') end |
#from ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….……
70 71 72 |
# File 'lib/agent_xmpp/xmpp/stanza.rb', line 70 def from (a = attribute('from')).nil? ? a : Jid.new(a.value) end |
#from=(v) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….……
75 76 77 |
# File 'lib/agent_xmpp/xmpp/stanza.rb', line 75 def from=(v) add_attribute('from', v ? v.to_s : nil) end |
#id ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….……
80 81 82 |
# File 'lib/agent_xmpp/xmpp/stanza.rb', line 80 def id (a = attribute('id')).nil? ? a : a.value end |
#id=(v) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….……
85 86 87 |
# File 'lib/agent_xmpp/xmpp/stanza.rb', line 85 def id=(v) add_attribute('id', v.to_s) end |
#normalize ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….……
56 57 |
# File 'lib/agent_xmpp/xmpp/stanza.rb', line 56 def normalize end |
#to ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….……
60 61 62 |
# File 'lib/agent_xmpp/xmpp/stanza.rb', line 60 def to (a = attribute('to')).nil? ? a : Jid.new(a.value) end |
#to=(v) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….……
65 66 67 |
# File 'lib/agent_xmpp/xmpp/stanza.rb', line 65 def to=(v) add_attribute('to', v ? v.to_s : nil) end |
#type ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….……
90 91 92 93 |
# File 'lib/agent_xmpp/xmpp/stanza.rb', line 90 def type stanza_type = attributes['type'] stanza_type.nil? ? nil : stanza_type.to_sym end |
#type=(t) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….……
96 97 98 |
# File 'lib/agent_xmpp/xmpp/stanza.rb', line 96 def type=(t) attributes['type'] = t.to_s end |