Class: Blather::Stanza::DiscoItems::Item
- Inherits:
-
XMPPNode
- Object
- Nokogiri::XML::Node
- XMPPNode
- Blather::Stanza::DiscoItems::Item
- Defined in:
- lib/blather/stanza/disco/disco_items.rb
Overview
An individual Disco Item
Constant Summary
Constants inherited from XMPPNode
Class Method Summary collapse
-
.new(jid, node = nil, name = nil) ⇒ Object
Create a new Blather::Stanza::DiscoItems::Item.
Instance Method Summary collapse
-
#eql?(o) ⇒ Boolean
(also: #==)
Check for equality based on jid, node, and name.
-
#jid ⇒ Blather::JID?
Get the JID attached to the node.
-
#jid=(jid) ⇒ Object
Set the JID of the node.
-
#name ⇒ String?
Get the Item name.
-
#name=(name) ⇒ Object
Set the Item name.
-
#node ⇒ String?
Get the name of the node.
-
#node=(node) ⇒ Object
Set the name of the node.
Methods inherited from XMPPNode
class_from_registration, #content_from, import, #inherit, #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(node) ⇒ Object .new(opts) ⇒ Object .new(jid, node = nil, name = nil) ⇒ Object
Create a new Blather::Stanza::DiscoItems::Item
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/blather/stanza/disco/disco_items.rb', line 64 def self.new(jid, node = nil, name = nil) new_node = super :item case jid when Nokogiri::XML::Node new_node.inherit jid when Hash new_node.jid = jid[:jid] new_node.node = jid[:node] new_node.name = jid[:name] else new_node.jid = jid new_node.node = node new_node.name = name end new_node end |
Instance Method Details
#eql?(o) ⇒ Boolean Also known as: ==
Check for equality based on jid, node, and name
127 128 129 130 131 132 133 134 135 |
# File 'lib/blather/stanza/disco/disco_items.rb', line 127 def eql?(o) unless o.is_a?(self.class) raise "Cannot compare #{self.class} with #{o.class}" end o.jid == self.jid && o.node == self.node && o.name == self.name end |
#jid ⇒ Blather::JID?
Get the JID attached to the node
85 86 87 |
# File 'lib/blather/stanza/disco/disco_items.rb', line 85 def jid (j = self[:jid]) ? JID.new(j) : nil end |
#jid=(jid) ⇒ Object
Set the JID of the node
92 93 94 |
# File 'lib/blather/stanza/disco/disco_items.rb', line 92 def jid=(jid) write_attr :jid, jid end |
#name ⇒ String?
Get the Item name
113 114 115 |
# File 'lib/blather/stanza/disco/disco_items.rb', line 113 def name read_attr :name end |
#name=(name) ⇒ Object
Set the Item name
120 121 122 |
# File 'lib/blather/stanza/disco/disco_items.rb', line 120 def name=(name) write_attr :name, name end |
#node ⇒ String?
Get the name of the node
99 100 101 |
# File 'lib/blather/stanza/disco/disco_items.rb', line 99 def node read_attr :node end |
#node=(node) ⇒ Object
Set the name of the node
106 107 108 |
# File 'lib/blather/stanza/disco/disco_items.rb', line 106 def node=(node) write_attr :node, node end |