Class: Blather::Stanza::Iq::Query
- Inherits:
-
Blather::Stanza::Iq
- Object
- Nokogiri::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
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=, next_id, register, #reply, #reply!, #to, #to=, #type, #type=
Methods inherited from XMPPNode
class_from_registration, #content_from, import, #inherit_attrs, #inspect, #namespace=, #namespace_href, #nokogiri_namespace=, #read_attr, #read_content, register, #remove_child, #remove_children, #set_content_for, #to_stanza, #write_attr
Methods inherited from Nokogiri::XML::Node
#[]=, #attr_set, #find_first, #nokogiri_xpath, #xpath
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 |