Class: Blather::Stanza::DiscoInfo::Identity
- Inherits:
-
XMPPNode
- Object
- Nokogiri::XML::Node
- XMPPNode
- Blather::Stanza::DiscoInfo::Identity
- Defined in:
- lib/blather/stanza/disco/disco_info.rb
Constant Summary
Constants inherited from XMPPNode
Class Method Summary collapse
-
.new(name, type = nil, category = nil) ⇒ Object
Create a new DiscoInfo Identity.
Instance Method Summary collapse
-
#category ⇒ Symbol?
The Identity’s category.
-
#category=(category) ⇒ Object
Set the Identity’s category.
-
#eql?(o) ⇒ true, false
(also: #==)
Compare two Identity objects by name, type and category.
-
#name ⇒ String
The Identity’s name.
-
#name=(name) ⇒ Object
Set the Identity’s name.
-
#type ⇒ Symbol?
The Identity’s type.
-
#type=(type) ⇒ Object
Set the Identity’s type.
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(name, type = nil, category = nil) ⇒ Object
Create a new DiscoInfo Identity
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/blather/stanza/disco/disco_info.rb', line 78 def self.new(name, type = nil, category = nil) new_node = super :identity case name when Nokogiri::XML::Node new_node.inherit name when Hash new_node.name = name[:name] new_node.type = name[:type] new_node.category = name[:category] else new_node.name = name new_node.type = type new_node.category = category end new_node end |
Instance Method Details
#category ⇒ Symbol?
The Identity’s category
98 99 100 |
# File 'lib/blather/stanza/disco/disco_info.rb', line 98 def category read_attr :category, :to_sym end |
#category=(category) ⇒ Object
Set the Identity’s category
104 105 106 |
# File 'lib/blather/stanza/disco/disco_info.rb', line 104 def category=(category) write_attr :category, category end |
#eql?(o) ⇒ true, false Also known as: ==
Compare two Identity objects by name, type and category
135 136 137 138 139 140 141 142 143 |
# File 'lib/blather/stanza/disco/disco_info.rb', line 135 def eql?(o) unless o.is_a?(self.class) raise "Cannot compare #{self.class} with #{o.class}" end o.name == self.name && o.type == self.type && o.category == self.category end |
#name ⇒ String
The Identity’s name
122 123 124 |
# File 'lib/blather/stanza/disco/disco_info.rb', line 122 def name read_attr :name end |
#name=(name) ⇒ Object
Set the Identity’s name
128 129 130 |
# File 'lib/blather/stanza/disco/disco_info.rb', line 128 def name=(name) write_attr :name, name end |
#type ⇒ Symbol?
The Identity’s type
110 111 112 |
# File 'lib/blather/stanza/disco/disco_info.rb', line 110 def type read_attr :type, :to_sym end |
#type=(type) ⇒ Object
Set the Identity’s type
116 117 118 |
# File 'lib/blather/stanza/disco/disco_info.rb', line 116 def type=(type) write_attr :type, type end |