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
brontes3d-xmpp4r-0.4 lib/xmpp4r/x.rb
bryanl-xmpp4r-0.3.2 lib/xmpp4r/x.rb
edavey-xmpp4r-0.4.1 lib/xmpp4r/x.rb
edavey-xmpp4r-0.4.2 lib/xmpp4r/x.rb
edavey-xmpp4r-0.4 lib/xmpp4r/x.rb
heipei-xmpp4r-0.3.2 lib/xmpp4r/x.rb
ln-xmpp4r-0.5 lib/xmpp4r/x.rb
mojodna-xmpp4r-0.4.0.2 lib/xmpp4r/x.rb
mojodna-xmpp4r-0.4.0.3 lib/xmpp4r/x.rb
seanohalpin-xmpp4r-0.4.1 lib/xmpp4r/x.rb
xmpp4r-0.5.5 lib/xmpp4r/x.rb
gmcmillan-xmpp4r-0.6.2 lib/xmpp4r/x.rb
gmcmillan-xmpp4r-0.6.1 lib/xmpp4r/x.rb
gmcmillan-xmpp4r-0.6 lib/xmpp4r/x.rb
gmcmillan-xmpp4r-0.5 lib/xmpp4r/x.rb
mad-p-xmpp4r-0.6.3 lib/xmpp4r/x.rb
mad-p-xmpp4r-0.6.2 lib/xmpp4r/x.rb
mad-p-xmpp4r-0.6.1 lib/xmpp4r/x.rb
mad-p-xmpp4r-0.6.0 lib/xmpp4r/x.rb
cerberus-0.8.0 lib/vendor/xmpp4r/lib/xmpp4r/x.rb