Class: RubySpeech::SSML::Sub
- Defined in:
- lib/ruby_speech/ssml/sub.rb
Overview
The sub element is employed to indicate that the text in the alias attribute value replaces the contained text for pronunciation. This allows a document to contain both a spoken and written form. The required alias attribute specifies the string to be spoken instead of the enclosed string. The processor should apply text normalization to the alias value.
The sub element can only contain text (no elements).
Constant Summary collapse
- VALID_CHILD_TYPES =
[Nokogiri::XML::Text, String].freeze
Instance Attribute Summary
Attributes included from GenericElement
Instance Method Summary collapse
- #<<(arg) ⇒ Object
-
#alias ⇒ String
Indicates the string to be spoken instead of the enclosed string.
- #alias=(other) ⇒ Object
- #eql?(o) ⇒ Boolean
Methods inherited from Element
module, namespace, root_element, #to_doc
Methods included from GenericElement
#+, #==, #base_uri, #base_uri=, #build, #children, #clone, #create_node, #embed, #eval_dsl_block, included, #inherit, #initialize, #inspect, #mass_assign, #method_missing, #namespace=, #namespace_href, #node, #nokogiri_children, #read_attr, #respond_to_missing?, #string, #to_s, #traverse, #version, #version=, #write_attr
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class RubySpeech::GenericElement
Instance Method Details
#<<(arg) ⇒ Object
34 35 36 37 |
# File 'lib/ruby_speech/ssml/sub.rb', line 34 def <<(arg) raise InvalidChildError, "A Sub can only accept Strings as children" unless VALID_CHILD_TYPES.include? arg.class super end |
#alias ⇒ String
Indicates the string to be spoken instead of the enclosed string
23 24 25 |
# File 'lib/ruby_speech/ssml/sub.rb', line 23 def alias read_attr :alias end |
#alias=(other) ⇒ Object
30 31 32 |
# File 'lib/ruby_speech/ssml/sub.rb', line 30 def alias=(other) self[:alias] = other end |
#eql?(o) ⇒ Boolean
39 40 41 |
# File 'lib/ruby_speech/ssml/sub.rb', line 39 def eql?(o) super o, :alias end |