Class: Plivo::XML::Lang
Constant Summary collapse
- VALID_LANG_ATTRIBUTE_VALUES =
[ 'arb', 'cmn-CN','da-DK','nl-NL','en-AU', 'en-GB', 'en-IN','en-US','en-GB-WLS','fr-FR', 'fr-CA','de-DE','hi-IN','is-IS','it-IT', 'ja-JP','ko-KR','nb-NO','pl-PL','pt-BR', 'pt-PT','ro-RO','ru-RU','es-ES','es-MX', 'es-US','sv-SE','tr-TR','cy-GB']
Constants inherited from Element
Instance Attribute Summary
Attributes inherited from Element
Instance Method Summary collapse
-
#initialize(body, attributes = {}) ⇒ Lang
constructor
A new instance of Lang.
Methods inherited from Element
#add, #add_attribute, #convert_value, #hyphenate, #method_missing, #to_s, #to_xml
Constructor Details
#initialize(body, attributes = {}) ⇒ Lang
Returns a new instance of Lang.
16 17 18 19 20 21 22 23 24 25 26 |
# 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 |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Plivo::XML::Element