Sha256: f4d71a1bb0977c2c418b48d5ed4a896337684cfbdcba69c0aeeb2964cbf53842

Contents?: true

Size: 989 Bytes

Versions: 1

Compression:

Stored size: 989 Bytes

Contents

require "sax-machine"

module Babylon
  module Base
    ##
    # Class used to Parse a Stanza on the XMPP stream.
    # You should have a Stanza subsclass for each of your controller actions, as they allow you to define which stanzas and which information is passed to yoru controllers.
    #
    # You can define your own macthing pretty easily with the element and elements methods, as explained in the SaxMachine Documentation: http://github.com/pauldix/sax-machine/tree/master
    # if your stanza is a message stanza, you can match the following for example:
    # element :message, :value => :to, :as => :to 
    # element :message, :value => :from, :as => :from 
    # element :message, :value => :id, :as => :stanza_id 
    # element :message, :value => :type, :as => :stanza_type 
    # element :message, :value => :"xml:lang", :as => :lang 
    #
    class Stanza
      include SAXMachine
      
      def initialize(xml = nil)
        parse(xml.to_s)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
julien51-babylon-0.1.0 lib/babylon/base/stanza.rb