Sha256: 0e04b7d0195a144c4b11e61c77739787d70fde9fe279071bbd71f80ffc0d2832

Contents?: true

Size: 1.03 KB

Versions: 33

Compression:

Stored size: 1.03 KB

Contents

# =XMPP4R - XMPP Library for Ruby
# License:: Ruby's license (see the LICENSE file) or GNU GPL, at your option.
# Website::http://home.gna.org/xmpp4r/

require 'xmpp4r/xmppelement'

module Jabber
  ##
  # A class used to build/parse <x/> elements
  #
  # These elements may occur as "attachments"
  # in [Message] and [Presence] stanzas
  class X < XMPPElement
    name_xmlns 'x'
    force_xmlns true
  end

  module XParent
    ##
    # 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
    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
  end
end

Version data entries

33 entries across 33 versions & 13 rubygems

Version Path
cerberus-0.7.9 lib/vendor/xmpp4r/lib/xmpp4r/x.rb
edavis10-cerberus-0.7.8 lib/vendor/xmpp4r/lib/xmpp4r/x.rb
cerberus-0.7.8 lib/vendor/xmpp4r/lib/xmpp4r/x.rb
cerberus-0.7.7 lib/vendor/xmpp4r/lib/xmpp4r/x.rb
cerberus-0.7.6 lib/vendor/xmpp4r/lib/xmpp4r/x.rb
cerberus-0.7.2 lib/vendor/xmpp4r/lib/xmpp4r/x.rb
cerberus-0.7.5 lib/vendor/xmpp4r/lib/xmpp4r/x.rb
cerberus-0.7 lib/vendor/xmpp4r/lib/xmpp4r/x.rb
xmpp4r-0.5 lib/xmpp4r/x.rb
mack-notifier-0.8.3 lib/gems/xmpp4r-0.4/lib/xmpp4r/x.rb
mack-notifier-0.8.2 lib/gems/xmpp4r-0.4/lib/xmpp4r/x.rb
mack-notifier-0.8.3.1 lib/gems/xmpp4r-0.4/lib/xmpp4r/x.rb
xmpp4r-0.4 lib/xmpp4r/x.rb