Sha256: 98df662feefb8d238b13f5bb384a7897224951dfb7bce27d59b4f8052bcf8c30

Contents?: true

Size: 1.25 KB

Versions: 18

Compression:

Stored size: 1.25 KB

Contents

require 'ruby_speech/ssml/element'

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

18 entries across 18 versions & 1 rubygems

Version Path
ruby_speech-3.0.1-java lib/ruby_speech/ssml/sub.rb
ruby_speech-3.0.1 lib/ruby_speech/ssml/sub.rb
ruby_speech-3.0.0-java lib/ruby_speech/ssml/sub.rb
ruby_speech-3.0.0 lib/ruby_speech/ssml/sub.rb
ruby_speech-2.4.0-java lib/ruby_speech/ssml/sub.rb
ruby_speech-2.4.0 lib/ruby_speech/ssml/sub.rb
ruby_speech-2.3.2-java lib/ruby_speech/ssml/sub.rb
ruby_speech-2.3.2 lib/ruby_speech/ssml/sub.rb
ruby_speech-2.3.1-java lib/ruby_speech/ssml/sub.rb
ruby_speech-2.3.1 lib/ruby_speech/ssml/sub.rb
ruby_speech-2.3.0-java lib/ruby_speech/ssml/sub.rb
ruby_speech-2.3.0 lib/ruby_speech/ssml/sub.rb
ruby_speech-2.2.2-java lib/ruby_speech/ssml/sub.rb
ruby_speech-2.2.2 lib/ruby_speech/ssml/sub.rb
ruby_speech-2.2.1-java lib/ruby_speech/ssml/sub.rb
ruby_speech-2.2.1 lib/ruby_speech/ssml/sub.rb
ruby_speech-2.2.0-java lib/ruby_speech/ssml/sub.rb
ruby_speech-2.2.0 lib/ruby_speech/ssml/sub.rb