Class: Plivo::XML::Phoneme
Constant Summary collapse
- VALID_ALPHABET_ATTRIBUTE_VALUES =
%w(ipa x-sampa x-amazon-pinyin)
Constants inherited from Element
Instance Attribute Summary
Attributes inherited from Element
Instance Method Summary collapse
-
#initialize(body, attributes = {}) ⇒ Phoneme
constructor
A new instance of Phoneme.
Methods inherited from Element
#add, #add_attribute, #convert_value, #hyphenate, #method_missing, #to_s, #to_xml
Constructor Details
#initialize(body, attributes = {}) ⇒ Phoneme
Returns a new instance of Phoneme.
9 10 11 12 13 14 15 16 17 |
# File 'lib/plivo/xml/phoneme.rb', line 9 def initialize(body, attributes = {}) unless attributes && attributes[:ph] raise PlivoXMLError, 'ph attribute is required for Phoneme' end if attributes && attributes[:alphabet] && !VALID_ALPHABET_ATTRIBUTE_VALUES.include?(attributes[:alphabet]) raise PlivoXMLError, "invalid attribute value #{attributes[:alphabet]} for alphabet" end super(body, attributes) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Plivo::XML::Element