Class: RubySpeech::GRXML::Ruleref
- Defined in:
- lib/ruby_speech/grxml/ruleref.rb
Overview
The ruleref element is an empty element which points to another rule expansion in the grammar document.
http://www.w3.org/TR/speech-grammar/#S2.2
Every rule definition has a local name that must be unique within the scope of the grammar in which it is defined. A rulename must match the “Name” Production of XML 1.0 [XML §2.3] and be a legal XML ID. Section 3.1 documents the rule definition mechanism and the legal naming of rules.
The ruleref has three attributes: uri, special and type. There can be one and only one of the uri or special attribute specified on any given ruleref element.
The uri attribute contains named identified named rule being referenced
optional ‘type’ attribute specifies the media type for the uri
Instance Attribute Summary
Attributes included from RubySpeech::GenericElement
Instance Method Summary collapse
- #<<(*args) ⇒ Object
- #eql?(o) ⇒ Boolean
-
#special ⇒ String
special…
-
#special=(sp) ⇒ Object
TODO: raise ArgumentError if not a valid special…
-
#uri ⇒ String
XML URI: in the XML Form of this specification any URI is provided as an attribute to an element; for example the ruleref and lexicon elements.
- #uri=(u) ⇒ Object
Methods inherited from Element
module, namespace, #regexp_content, root_element, #to_doc
Methods included from RubySpeech::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
#<<(*args) ⇒ Object
60 61 62 |
# File 'lib/ruby_speech/grxml/ruleref.rb', line 60 def <<(*args) raise InvalidChildError, "A Ruleref cannot contain children" end |
#eql?(o) ⇒ Boolean
64 65 66 |
# File 'lib/ruby_speech/grxml/ruleref.rb', line 64 def eql?(o) super o, :uri, :special end |
#special ⇒ String
special…
45 46 47 |
# File 'lib/ruby_speech/grxml/ruleref.rb', line 45 def special read_attr :special end |
#special=(sp) ⇒ Object
TODO: raise ArgumentError if not a valid special…
54 55 56 57 58 |
# File 'lib/ruby_speech/grxml/ruleref.rb', line 54 def special=(sp) raise ArgumentError, "A Ruleref can only take uri or special" if uri raise ArgumentError, "The Ruleref#special method only takes :NULL, :VOID, and :GARBAGE" unless %w{NULL VOID GARBAGE}.include? sp.to_s self[:special] = sp end |
#uri ⇒ String
XML URI: in the XML Form of this specification any URI is provided as an attribute to an element; for example the ruleref and lexicon elements.
26 27 28 |
# File 'lib/ruby_speech/grxml/ruleref.rb', line 26 def uri read_attr :uri end |
#uri=(u) ⇒ Object
35 36 37 38 |
# File 'lib/ruby_speech/grxml/ruleref.rb', line 35 def uri=(u) raise ArgumentError, "A Ruleref can only take uri or special" if special self[:uri] = u end |