Class | Jabber::Version::IqQueryVersion |
In: |
lib/xmpp4r/version/iq/version.rb
|
Parent: | IqQuery |
Class for handling queries for ‘Software Version’ (JEP 0092)
Notice that according to JEP 0092 only the <os/> element can be omitted, <name/> (iname) and <version/> must be present
Create a new <query xmlns=’jabber:iq:version’/> element
# File lib/xmpp4r/version/iq/version.rb, line 18 18: def initialize(iname='', version='', os=nil) 19: super() 20: add_namespace('jabber:iq:version') 21: set_iname(iname) 22: set_version(version) 23: set_os(os) 24: end
Import an element, deletes <name/>, <version/> and <os/> elements first
xe: | [REXML::Element] |
# File lib/xmpp4r/version/iq/version.rb, line 30 30: def import(xe) 31: delete_element('name') 32: delete_element('version') 33: delete_element('os') 34: super 35: end
Get the name of the software
This has been renamed to ‘iname’ here to keep REXML::Element#name accessible
# File lib/xmpp4r/version/iq/version.rb, line 42 42: def iname 43: first_element_text('name') 44: end
Set the name of the software
The element won’t be deleted if text is nil as it must occur in a version query, but its text will be empty.
# File lib/xmpp4r/version/iq/version.rb, line 52 52: def iname=(text) 53: replace_element_text('name', text.nil? ? '' : text) 54: end
Set the os of the software
text: | [String] or nil |
# File lib/xmpp4r/version/iq/version.rb, line 98 98: def os=(text) 99: if text 100: replace_element_text('os', text) 101: else 102: delete_elements('os') 103: end 104: end
Set the name of the software (chaining-friendly)
result: | [String] or nil |
# File lib/xmpp4r/version/iq/version.rb, line 59 59: def set_iname(text) 60: self.iname = text 61: self 62: end
Set the os of the software (chaining-friendly)
text: | [String] or nil |
# File lib/xmpp4r/version/iq/version.rb, line 109 109: def set_os(text) 110: self.os = text 111: self 112: end
Set the version of the software (chaining-friendly)
text: | [String] |
# File lib/xmpp4r/version/iq/version.rb, line 83 83: def set_version(text) 84: self.version = text 85: self 86: end
Get the version of the software
result: | [String] or nil |
# File lib/xmpp4r/version/iq/version.rb, line 67 67: def version 68: first_element_text('version') 69: end