Class: Blather::Stanza::PubSub::Subscriptions
- Inherits:
-
Blather::Stanza::PubSub
- Object
- Nokogiri::XML::Node
- XMPPNode
- Blather::Stanza
- Iq
- Blather::Stanza::PubSub
- Blather::Stanza::PubSub::Subscriptions
- Includes:
- Enumerable
- Defined in:
- lib/blather/stanza/pubsub/subscriptions.rb
Constant Summary
Constants inherited from Iq
Constants inherited from XMPPNode
Class Method Summary collapse
-
.new(type = nil, host = nil) ⇒ Object
Ensure the namespace is set to the query node.
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#inherit(node) ⇒ Object
Kill the pubsub node before running inherit.
- #list ⇒ Object
- #size ⇒ Object
- #subscriptions ⇒ Object
Methods inherited from Blather::Stanza::PubSub
Methods inherited from Iq
Methods inherited from Blather::Stanza
#as_error, attribute_helpers_for, #from, handler_list, next_id, register, #reply, #reply!, #to
Methods inherited from XMPPNode
attribute_accessor, attribute_reader, attribute_writer, class_from_registration, content_attr_accessor, content_attr_reader, content_attr_writer, #content_from, import, #inherit_attrs, #namespace=, #namespace_href, #nokogiri_namespace=, register, #remove_child, #remove_children, #set_content_for, #to_stanza
Methods inherited from Nokogiri::XML::Node
#[]=, #attr_set, #find_first, #nokogiri_xpath, #xpath
Class Method Details
.new(type = nil, host = nil) ⇒ Object
Ensure the namespace is set to the query node
13 14 15 16 17 18 |
# File 'lib/blather/stanza/pubsub/subscriptions.rb', line 13 def self.new(type = nil, host = nil) new_node = super type new_node.to = host new_node.subscriptions new_node end |
Instance Method Details
#each(&block) ⇒ Object
33 34 35 |
# File 'lib/blather/stanza/pubsub/subscriptions.rb', line 33 def each(&block) list.each &block end |
#inherit(node) ⇒ Object
Kill the pubsub node before running inherit
22 23 24 25 |
# File 'lib/blather/stanza/pubsub/subscriptions.rb', line 22 def inherit(node) subscriptions.remove super end |
#list ⇒ Object
41 42 43 44 45 46 47 48 49 50 |
# File 'lib/blather/stanza/pubsub/subscriptions.rb', line 41 def list subscriptions.find('//ns:subscription', :ns => self.class.registered_ns).inject({}) do |hash, item| hash[item[:subscription].to_sym] ||= [] hash[item[:subscription].to_sym] << { :node => item[:node], :jid => item[:jid] } hash end end |
#size ⇒ Object
37 38 39 |
# File 'lib/blather/stanza/pubsub/subscriptions.rb', line 37 def size list.size end |