Class: Blather::Stanza::Iq::Roster
- Inherits:
-
Query
- Object
- Nokogiri::XML::Node
- XMPPNode
- Blather::Stanza
- Blather::Stanza::Iq
- Query
- Blather::Stanza::Iq::Roster
- Defined in:
- lib/blather/stanza/iq/roster.rb
Defined Under Namespace
Classes: RosterItem
Constant Summary
Constants inherited from Blather::Stanza::Iq
Constants inherited from XMPPNode
Class Method Summary collapse
-
.new(type = nil, item = nil) ⇒ Object
Any new items are added to the query.
Instance Method Summary collapse
-
#inherit(node) ⇒ Object
Inherit the XMPPNode to create a proper Roster object.
-
#items ⇒ Object
Roster items.
Methods inherited from Query
Methods inherited from Blather::Stanza::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, item = nil) ⇒ Object
Any new items are added to the query
10 11 12 13 14 |
# File 'lib/blather/stanza/iq/roster.rb', line 10 def self.new(type = nil, item = nil) node = super type node.query << item if item node end |
Instance Method Details
#inherit(node) ⇒ Object
Inherit the XMPPNode to create a proper Roster object. Creates RosterItem objects out of each roster item as well.
19 20 21 22 23 24 25 26 |
# File 'lib/blather/stanza/iq/roster.rb', line 19 def inherit(node) # remove the current set of nodes remove_children :item super # transmogrify nodes into RosterItems items.each { |i| query << RosterItem.new(i); i.remove } self end |
#items ⇒ Object
Roster items
30 31 32 |
# File 'lib/blather/stanza/iq/roster.rb', line 30 def items query.find('//ns:item', :ns => self.class.registered_ns).map { |i| RosterItem.new(i) } end |