Sha256: 69356130ef585ff6e03499b7a9a394842ce140499df0d963f894885e6fdeecce

Contents?: true

Size: 1.21 KB

Versions: 11

Compression:

Stored size: 1.21 KB

Contents

module RubySpeech
  module SSML
    ##
    # 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).
    #
    # http://www.w3.org/TR/speech-synthesis/#S3.1.10
    #
    class Sub < Element

      register :sub

      VALID_CHILD_TYPES = [Nokogiri::XML::Text, String].freeze

      ##
      # Indicates the string to be spoken instead of the enclosed string
      #
      # @return [String]
      #
      def alias
        read_attr :alias
      end

      ##
      # @param [String] other the string to be spoken instead of the enclosed string
      #
      def alias=(other)
        self[:alias] = other
      end

      def <<(arg)
        raise InvalidChildError, "A Sub can only accept Strings as children" unless VALID_CHILD_TYPES.include? arg.class
        super
      end

      def eql?(o)
        super o, :alias
      end
    end # Sub
  end # SSML
end # RubySpeech

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
ruby_speech-2.1.2-java lib/ruby_speech/ssml/sub.rb
ruby_speech-2.1.2 lib/ruby_speech/ssml/sub.rb
ruby_speech-2.1.1-java lib/ruby_speech/ssml/sub.rb
ruby_speech-2.1.1 lib/ruby_speech/ssml/sub.rb
ruby_speech-2.1.0-java lib/ruby_speech/ssml/sub.rb
ruby_speech-2.1.0 lib/ruby_speech/ssml/sub.rb
ruby_speech-2.0.2 lib/ruby_speech/ssml/sub.rb
ruby_speech-2.0.1 lib/ruby_speech/ssml/sub.rb
ruby_speech-1.1.0 lib/ruby_speech/ssml/sub.rb
ruby_speech-1.0.2 lib/ruby_speech/ssml/sub.rb
ruby_speech-1.0.1 lib/ruby_speech/ssml/sub.rb