Class: AgentXmpp::Xmpp::RosterItem
- Inherits:
-
Element
- Object
- REXML::Element
- Element
- AgentXmpp::Xmpp::RosterItem
- Defined in:
- lib/agent_xmpp/xmpp/iq_roster.rb
Overview
Instance Method Summary (collapse)
-
- (Object) ask
.......................................................................................................
-
- (Object) ask=(val)
.......................................................................................................
-
- (Object) groups
.......................................................................................................
-
- (Object) groups=(ary)
.......................................................................................................
-
- (Object) iname
.......................................................................................................
-
- (Object) iname=(val)
.......................................................................................................
-
- (RosterItem) initialize(jid = nil, iname = nil, subscription = nil, ask = nil)
constructor
.......................................................................................................
-
- (Object) jid
.......................................................................................................
-
- (Object) jid=(val)
.......................................................................................................
Methods inherited from Element
#<<, class_for_name_xmlns, #clone, import, name_xmlns, name_xmlns_for_class, #parent=, #set_xml_lang, #typed_add, #xml_lang, #xml_lang=, xmpp_attribute, xmpp_child
Methods inherited from REXML::Element
#delete_elements, #first_element, #first_element_text, import, #import, #replace_element_text, #typed_add
Constructor Details
- (RosterItem) initialize(jid = nil, iname = nil, subscription = nil, ask = nil)
.......................................................................................................
120 121 122 123 124 125 126 |
# File 'lib/agent_xmpp/xmpp/iq_roster.rb', line 120 def initialize(jid=nil, iname=nil, subscription=nil, ask=nil) super() self.jid = jid self.iname = iname if iname self.subscription = subscription if subscription self.ask = ask if ask end |
Instance Method Details
- (Object) ask
.......................................................................................................
149 150 151 152 153 154 |
# File 'lib/agent_xmpp/xmpp/iq_roster.rb', line 149 def ask case attributes['ask'] when 'subscribe' then :subscribe else :none end end |
- (Object) ask=(val)
.......................................................................................................
157 158 159 160 161 162 |
# File 'lib/agent_xmpp/xmpp/iq_roster.rb', line 157 def ask=(val) case val when :subscribe then attributes['ask'] = 'subscribe' else attributes['ask'] = nil end end |
- (Object) groups
.......................................................................................................
165 166 167 |
# File 'lib/agent_xmpp/xmpp/iq_roster.rb', line 165 def groups elements.inject('group', []) {|r, g| r << g.text}.uniq end |
- (Object) groups=(ary)
.......................................................................................................
170 171 172 173 |
# File 'lib/agent_xmpp/xmpp/iq_roster.rb', line 170 def groups=(ary) delete_elements('group') ary.uniq.each{|group| add_element('group').text = group} end |
- (Object) iname
.......................................................................................................
129 130 131 |
# File 'lib/agent_xmpp/xmpp/iq_roster.rb', line 129 def iname attributes['name'] end |
- (Object) iname=(val)
.......................................................................................................
134 135 136 |
# File 'lib/agent_xmpp/xmpp/iq_roster.rb', line 134 def iname=(val) attributes['name'] = val end |
- (Object) jid
.......................................................................................................
139 140 141 |
# File 'lib/agent_xmpp/xmpp/iq_roster.rb', line 139 def jid (a = attributes['jid']) ? Jid.new(a) : nil end |
- (Object) jid=(val)
.......................................................................................................
144 145 146 |
# File 'lib/agent_xmpp/xmpp/iq_roster.rb', line 144 def jid=(val) attributes['jid'] = val.nil? ? nil : val.to_s end |