Sha256: 015c1cd582a11cc0cd3a9d461b6932540f048e22c76c460bef3aa0bd3d9dbaed

Contents?: true

Size: 612 Bytes

Versions: 1

Compression:

Stored size: 612 Bytes

Contents

module Blather
class Stanza

  ##
  # Base Iq stanza
  class Iq < Stanza
    register :iq

    def self.import(node)
      raise "Import missmatch #{[node.element_name, self.name].inspect}" if node.element_name != self.name.to_s
      klass = nil
      node.each { |e| break if klass = class_from_registration(e.element_name, e.xmlns) }
      (klass || self).new(node['type']).inherit(node)
    end

    def self.new(type = nil, to = nil, id = nil)
      elem = super :iq
      elem.xmlns = nil
      elem.type = type || :get
      elem.to = to
      elem.id = id if id
      elem
    end
  end

end #Stanza
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
blather-0.2 lib/blather/stanza/iq.rb