Class: Blather::Stanza::Iq::Query
- Inherits:
-
Blather::Stanza::Iq
- Object
- Niceogiri::XML::Node
- XMPPNode
- Blather::Stanza
- Blather::Stanza::Iq
- Blather::Stanza::Iq::Query
- Defined in:
- lib/blather/stanza/iq/query.rb
Overview
# Query Stanza
This is a base class for any query based Iq stanzas. It provides a base set of methods for working with query stanzas
Constant Summary
Constants inherited from Blather::Stanza::Iq
Constants inherited from XMPPNode
Instance Attribute Summary
Attributes inherited from Blather::Stanza
Class Method Summary collapse
-
.new(type = nil) ⇒ Object
Overrides the parent method to ensure a query node is created.
Instance Method Summary collapse
-
#inherit(node) ⇒ Object
Overrides the parent method to ensure the current query node is destroyed.
-
#query ⇒ Balather::XMPPNode
Query node accessor If a query node exists it will be returned.
Methods inherited from Blather::Stanza::Iq
#error?, #get?, import, #reply!, #result?, #set?, #type=
Methods inherited from Blather::Stanza
#as_error, #error?, #from, #from=, handler_list, #id, #id=, #initialize, next_id, register, #reply, #reply!, #to, #to=, #type, #type=
Methods inherited from XMPPNode
class_from_registration, #decorate, decorator_modules, import, parse, register, #to_stanza
Constructor Details
This class inherits a constructor from Blather::Stanza
Class Method Details
.new(type = nil) ⇒ Object
Overrides the parent method to ensure a query node is created
17 18 19 20 21 |
# File 'lib/blather/stanza/iq/query.rb', line 17 def self.new(type = nil) node = super node.query node end |
Instance Method Details
#inherit(node) ⇒ Object
Overrides the parent method to ensure the current query node is destroyed
26 27 28 29 |
# File 'lib/blather/stanza/iq/query.rb', line 26 def inherit(node) query.remove super end |
#query ⇒ Balather::XMPPNode
Query node accessor If a query node exists it will be returned. Otherwise a new node will be created and returned
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/blather/stanza/iq/query.rb', line 36 def query q = if self.class.registered_ns find_first('query_ns:query', :query_ns => self.class.registered_ns) else find_first('query') end unless q (self << (q = XMPPNode.new('query', self.document))) q.namespace = self.class.registered_ns end q end |