Sha256: 405e4a7a9121dd5b3ff6440ab7dd07e8b1b5a97e354529a7f7e70130cc4b8858

Contents?: true

Size: 799 Bytes

Versions: 6

Compression:

Stored size: 799 Bytes

Contents

require 'ruby_speech/grxml/matcher'
require 'ruby_speech/grxml/element'

module RubySpeech
  module GRXML
    InvalidChildError = Class.new StandardError

    GRXML_NAMESPACE = 'http://www.w3.org/2001/06/grammar'

    %w{
      grammar
      rule
      item
      one_of
      ruleref
      tag
      token
    }.each { |f| require "ruby_speech/grxml/#{f}" }

    def self.draw(attributes = {}, &block)
      document = Nokogiri::XML::Document.new
      Grammar.new(document, attributes).tap do |grammar|
        document.root = grammar.node
        block_return = grammar.eval_dsl_block &block
        grammar << block_return if block_return.is_a?(String)
      end.assert_has_matching_root_rule
    end

    def self.import(other)
      Element.import other
    end
  end # GRXML
end # RubySpeech

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ruby_speech-2.2.2-java lib/ruby_speech/grxml.rb
ruby_speech-2.2.2 lib/ruby_speech/grxml.rb
ruby_speech-2.2.1-java lib/ruby_speech/grxml.rb
ruby_speech-2.2.1 lib/ruby_speech/grxml.rb
ruby_speech-2.2.0-java lib/ruby_speech/grxml.rb
ruby_speech-2.2.0 lib/ruby_speech/grxml.rb