Class: Blather::Stanza::PubSub::Retract
Constant Summary
Constants inherited
from Iq
Iq::VALID_TYPES
Constants inherited
from XMPPNode
XMPPNode::BASE_NAMES
Class Method Summary
collapse
Instance Method Summary
collapse
import, #inherit, #pubsub
Methods inherited from Iq
import, #type=
#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, #inherit_attrs, #namespace=, #namespace_href, #nokogiri_namespace=, register, #remove_child, #remove_children, #set_content_for, #to_stanza
#[]=, #attr_set, #find_first, #nokogiri_xpath, #xpath
Class Method Details
.new(host = nil, node = nil, type = :set, retractions = []) ⇒ Object
11
12
13
14
15
16
|
# File 'lib/blather/stanza/pubsub/retract.rb', line 11
def self.new(host = nil, node = nil, type = :set, retractions = [])
new_node = super(type, host)
new_node.node = node
new_node.retractions = retractions
new_node
end
|
Instance Method Details
#each(&block) ⇒ Object
42
43
44
|
# File 'lib/blather/stanza/pubsub/retract.rb', line 42
def each(&block)
retractions.each &block
end
|
18
19
20
|
# File 'lib/blather/stanza/pubsub/retract.rb', line 18
def node
retract[:node]
end
|
#node=(node) ⇒ Object
22
23
24
|
# File 'lib/blather/stanza/pubsub/retract.rb', line 22
def node=(node)
retract[:node] = node
end
|
26
27
28
29
30
31
32
|
# File 'lib/blather/stanza/pubsub/retract.rb', line 26
def retract
unless retract = pubsub.find_first('ns:retract', :ns => self.class.registered_ns)
self.pubsub << (retract = XMPPNode.new('retract', self.document))
retract.namespace = self.pubsub.namespace
end
retract
end
|
#retractions ⇒ Object
38
39
40
|
# File 'lib/blather/stanza/pubsub/retract.rb', line 38
def retractions
retract.find('ns:item', :ns => self.class.registered_ns).map { |i| i[:id] }
end
|
#retractions=(retractions = []) ⇒ Object
34
35
36
|
# File 'lib/blather/stanza/pubsub/retract.rb', line 34
def retractions=(retractions = [])
[retractions].flatten.each { |id| self.retract << PubSubItem.new(id, nil, self.document) }
end
|
46
47
48
|
# File 'lib/blather/stanza/pubsub/retract.rb', line 46
def size
retractions.size
end
|