class Vines::StreamError

Constants

NAMESPACE

Public Class Methods

new(text=nil) click to toggle source
# File lib/vines/error.rb, line 40
def initialize(text=nil)
  @text = text
end

Public Instance Methods

to_xml() click to toggle source
# File lib/vines/error.rb, line 44
def to_xml
  doc = Document.new
  doc.create_element('stream:error') do |el|
    el << doc.create_element(element_name, 'xmlns' => NAMESPACE)
    if @text
      el << doc.create_element('text', @text, 'xmlns' => NAMESPACE, 'xml:lang' => 'en')
    end
  end.to_xml(:indent => 0).gsub(/\n/, '')
end