Class: Blather::Stanza::DiscoInfo::Identity
- Inherits:
-
XMPPNode
- Object
- Niceogiri::XML::Node
- XMPPNode
- Blather::Stanza::DiscoInfo::Identity
- Defined in:
- lib/blather/stanza/disco/disco_info.rb
Overview
DiscoInfo::Identity
Constant Summary
Constants inherited from XMPPNode
Class Method Summary collapse
-
.new(name, type = nil, category = nil, xml_lang = 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, *fields) ⇒ true, false
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.
-
#xml_lang ⇒ String
The Identity’s xml_lang.
-
#xml_lang=(xml_lang) ⇒ Object
Set the Identity’s name.
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(name, type = nil, category = nil) ⇒ Object
Create a new DiscoInfo::Identity
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/blather/stanza/disco/disco_info.rb', line 86 def self.new(name, type = nil, category = nil, xml_lang = 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] new_node.xml_lang = name[:xml_lang] else new_node.name = name new_node.type = type new_node.category = category new_node.xml_lang = xml_lang end new_node end |
Instance Method Details
#category ⇒ Symbol?
The Identity’s category
108 109 110 |
# File 'lib/blather/stanza/disco/disco_info.rb', line 108 def category read_attr :category, :to_sym end |
#category=(category) ⇒ Object
Set the Identity’s category
114 115 116 |
# File 'lib/blather/stanza/disco/disco_info.rb', line 114 def category=(category) write_attr :category, category end |
#eql?(o, *fields) ⇒ true, false
Compare two Identity objects by name, type and category
157 158 159 |
# File 'lib/blather/stanza/disco/disco_info.rb', line 157 def eql?(o, *fields) super o, *(fields + [:name, :type, :category, :xml_lang]) end |
#name ⇒ String
The Identity’s name
132 133 134 |
# File 'lib/blather/stanza/disco/disco_info.rb', line 132 def name read_attr :name end |
#name=(name) ⇒ Object
Set the Identity’s name
138 139 140 |
# File 'lib/blather/stanza/disco/disco_info.rb', line 138 def name=(name) write_attr :name, name end |
#type ⇒ Symbol?
The Identity’s type
120 121 122 |
# File 'lib/blather/stanza/disco/disco_info.rb', line 120 def type read_attr :type, :to_sym end |
#type=(type) ⇒ Object
Set the Identity’s type
126 127 128 |
# File 'lib/blather/stanza/disco/disco_info.rb', line 126 def type=(type) write_attr :type, type end |
#xml_lang ⇒ String
The Identity’s xml_lang
144 145 146 |
# File 'lib/blather/stanza/disco/disco_info.rb', line 144 def xml_lang read_attr "lang" end |
#xml_lang=(xml_lang) ⇒ Object
Set the Identity’s name
150 151 152 |
# File 'lib/blather/stanza/disco/disco_info.rb', line 150 def xml_lang=(xml_lang) write_attr "xml:lang", xml_lang end |