class Plivo::XML::Lang

Constants

VALID_LANG_ATTRIBUTE_VALUES

Public Class Methods

new(body, attributes = {}) click to toggle source
Calls superclass method Plivo::XML::Element::new
# File lib/plivo/xml/lang.rb, line 16
def initialize(body, attributes = {})
  if attributes && attributes[:xmllang]
    unless VALID_LANG_ATTRIBUTE_VALUES.include?(attributes[:xmllang])
      raise PlivoXMLError, "invalid attribute value #{attributes[:xmllang]} for xmllang"
    end
    super(body, {})
    add_attribute("xml:lang", attributes[:xmllang])
  else
    raise PlivoXMLError, 'xmllang attribute is a required attribute for lang'
  end
end