Module: AgentXmpp::Parser
- Includes:
- EventMachine::XmlPushParser
- Included in:
- Connection
- Defined in:
- lib/agent_xmpp/client/parser.rb
Overview
Instance Attribute Summary collapse
-
#stream_features ⇒ Object
readonly
———————————————————————————————————.
-
#stream_mechanisms ⇒ Object
readonly
———————————————————————————————————.
Instance Method Summary collapse
-
#characters(text) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….….….
-
#end_element(name) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….….….
-
#error(*args) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….….….
-
#process ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….….….
-
#start_document ⇒ Object
——————————————————————————————————— EventMachine::XmlPushParser callbacks .….….….….….….….….….….….….….….….….….….….….….….….….….….
-
#start_element(name, attrs) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….….….
Instance Attribute Details
#stream_features ⇒ Object (readonly)
12 13 14 |
# File 'lib/agent_xmpp/client/parser.rb', line 12 def stream_features @stream_features end |
#stream_mechanisms ⇒ Object (readonly)
12 13 14 |
# File 'lib/agent_xmpp/client/parser.rb', line 12 def stream_mechanisms @stream_mechanisms end |
Instance Method Details
#characters(text) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….….….
43 44 45 |
# File 'lib/agent_xmpp/client/parser.rb', line 43 def characters(text) @current.text = @current.text.to_s + text if @current end |
#end_element(name) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….….….
33 34 35 36 37 38 39 40 |
# File 'lib/agent_xmpp/client/parser.rb', line 33 def end_element(name) if @current.parent @current = @current.parent else process @current = nil end end |
#error(*args) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….….….
48 49 50 |
# File 'lib/agent_xmpp/client/parser.rb', line 48 def error(*args) AgentXmpp.logger.error *args end |
#process ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….….….
53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/agent_xmpp/client/parser.rb', line 53 def process @current.add_namespace(@streamns) if @current.namespace('').to_s.eql?('') begin stanza = Jabber::XMPPStanza::import(@current) rescue Jabber::NoNameXmlnsRegistered stanza = @current end if @current.xpath.eql?('stream:stream') @streamns = @current.namespace('') if @current.namespace('') end receive(stanza) if respond_to?(:receive) end |
#start_document ⇒ Object
EventMachine::XmlPushParser callbacks .….….….….….….….….….….….….….….….….….….….….….….….….….….
18 19 |
# File 'lib/agent_xmpp/client/parser.rb', line 18 def start_document end |
#start_element(name, attrs) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….….….
22 23 24 25 26 27 28 29 30 |
# File 'lib/agent_xmpp/client/parser.rb', line 22 def start_element(name, attrs) e = REXML::Element.new(name) e.add_attributes(attrs) @current = @current.nil? ? e : @current.add_element(e) if @current.xpath == 'stream:stream' process @current = nil end end |