Class: Blather::Stanza::DiscoItems

Inherits:
Disco show all
Defined in:
lib/blather/stanza/disco/disco_items.rb

Defined Under Namespace

Classes: Item

Constant Summary

Constants inherited from Iq

Iq::VALID_TYPES

Constants inherited from XMPPNode

XMPPNode::BASE_NAMES

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Iq::Query

#inherit, #query, #reply, #reply!

Methods inherited from Iq

import, #type=

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, #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, node = nil, items = []) ⇒ Object



7
8
9
10
11
12
# File 'lib/blather/stanza/disco/disco_items.rb', line 7

def self.new(type = nil, node = nil, items = [])
  new_node = super type
  new_node.node = node
  [items].flatten.each { |item| new_node.query << Item.new(item) }
  new_node
end

Instance Method Details

#itemsObject



14
15
16
# File 'lib/blather/stanza/disco/disco_items.rb', line 14

def items
  query.find('//query_ns:item', :query_ns => self.class.registered_ns).map { |i| Item.new i }
end

#nodeObject



22
23
24
# File 'lib/blather/stanza/disco/disco_items.rb', line 22

def node
  query[:node]
end

#node=(node) ⇒ Object



18
19
20
# File 'lib/blather/stanza/disco/disco_items.rb', line 18

def node=(node)
  query[:node] = node
end