Sha256: a2999cb8a1c9434d0072f49b9a2a6e618f777623c201193088b851efe79f7ed3

Contents?: true

Size: 893 Bytes

Versions: 6

Compression:

Stored size: 893 Bytes

Contents

module RubySpeech
  module GRXML
    ##
    #
    # The tag element is one of the valid expansion elements for the SGR rule element
    #
    #   http://www.w3.org/TR/speech-grammar/#S2.6
    #
    #
    # TODO: Make sure this is complete...
    #
    #
    class Tag < Element

      register :tag

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

      ##
      # Create a new GRXML tag element
      #
      # @param [Hash] atts Key-value pairs of options mapping to setter methods
      #
      # @return [Tag] an element for use in an GRXML document
      #
      def self.new(atts = {}, &block)
        super 'tag', atts, &block
      end

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ruby_speech-0.4.0 lib/ruby_speech/grxml/tag.rb
ruby_speech-0.3.4 lib/ruby_speech/grxml/tag.rb
ruby_speech-0.3.3 lib/ruby_speech/grxml/tag.rb
ruby_speech-0.3.2 lib/ruby_speech/grxml/tag.rb
ruby_speech-0.3.1 lib/ruby_speech/grxml/tag.rb
ruby_speech-0.3.0 lib/ruby_speech/grxml/tag.rb