Class: 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, *fields) ⇒ true, false
Compare two DiscoItems::Item objects by name, type and category.
-
#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, #decorate, decorator_modules, import, parse, register, #to_stanza
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, *fields) ⇒ true, false
Compare two DiscoItems::Item objects by name, type and category
127 128 129 |
# File 'lib/blather/stanza/disco/disco_items.rb', line 127 def eql?(o, *fields) super o, *(fields + [:jid, :node, :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 |