Module: Jabber::XParent

Included in:
MUC::IqQueryMUCAdmin, MUC::IqQueryMUCOwner, Message, Presence
Defined in:
lib/xmpp4r/x.rb

Instance Method Summary collapse

Instance Method Details

#x(wanted_xmlns = nil) ⇒ Object

Get the first <x/> element in this stanza, or nil if none found.

wanted_xmlns
String

Optional, find the first <x/> element having this xmlns,

wanted_xmlns can also be a derivate of XMPPElement from which the namespace will be taken

result
REXML::Element

or nil



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/xmpp4r/x.rb', line 24

def x(wanted_xmlns=nil)
  if wanted_xmlns.kind_of? Class and wanted_xmlns.ancestors.include? XMPPElement
    wanted_xmlns = wanted_xmlns.new.namespace
  end

    each_element('x') { |x|
    if wanted_xmlns.nil? or wanted_xmlns == x.namespace
      return x
    end
  }
  nil
end