Class: Adhearsion::Rayo::Component::Output::Document
- Defined in:
- lib/adhearsion/rayo/component/output.rb
Constant Summary collapse
- SSML_CONTENT_TYPE =
'application/ssml+xml'
Instance Attribute Summary
Attributes inherited from RayoNode
#client, #connection, #original_component
Instance Method Summary collapse
-
#content_type ⇒ String
The document content type.
- #inherit(xml_node) ⇒ Object
- #rayo_attributes ⇒ Object
- #rayo_children(root) ⇒ Object
- #size ⇒ Object
- #ssml? ⇒ Boolean
-
#url ⇒ String
The URL from which the fetch the grammar.
-
#value ⇒ String, ...
The document.
Methods inherited from RayoNode
#==, class_from_registration, from_xml, #inspect, register, #source, #to_rayo, #to_xml
Instance Method Details
#content_type ⇒ String
Returns the document content type.
22 |
# File 'lib/adhearsion/rayo/component/output.rb', line 22 attribute :content_type, String, default: ->(grammar, attribute) { grammar.url ? nil : SSML_CONTENT_TYPE } |
#inherit(xml_node) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/adhearsion/rayo/component/output.rb', line 27 def inherit(xml_node) super self.value = if ssml? RubySpeech::SSML.import xml_node.content elsif urilist? URIList.import xml_node.content else xml_node.content end self end |
#rayo_attributes ⇒ Object
39 40 41 42 43 44 |
# File 'lib/adhearsion/rayo/component/output.rb', line 39 def rayo_attributes { 'url' => url, 'content-type' => content_type } end |
#rayo_children(root) ⇒ Object
46 47 48 49 |
# File 'lib/adhearsion/rayo/component/output.rb', line 46 def rayo_children(root) root.cdata xml_value super end |
#size ⇒ Object
51 52 53 54 55 56 57 |
# File 'lib/adhearsion/rayo/component/output.rb', line 51 def size if ssml? value.children.count else value.size end end |
#ssml? ⇒ Boolean
59 60 61 |
# File 'lib/adhearsion/rayo/component/output.rb', line 59 def ssml? content_type == SSML_CONTENT_TYPE end |
#url ⇒ String
Returns the URL from which the fetch the grammar.
19 |
# File 'lib/adhearsion/rayo/component/output.rb', line 19 attribute :url |
#value ⇒ String, ...
Returns the document.
25 |
# File 'lib/adhearsion/rayo/component/output.rb', line 25 attribute :value |