Class: Punchblock::Component::Output::Document
Constant Summary
collapse
- SSML_CONTENT_TYPE =
'application/ssml+xml'
Instance Attribute Summary
Attributes inherited from RayoNode
#client, #connection, #original_component
Instance Method Summary
collapse
Methods inherited from RayoNode
#==, class_from_registration, from_xml, #inspect, register, #source, #to_rayo, #to_xml
Instance Method Details
#content_type ⇒ String
20
|
# File 'lib/punchblock/component/output.rb', line 20
attribute :content_type, String, default: ->(grammar, attribute) { grammar.url ? nil : SSML_CONTENT_TYPE }
|
#inherit(xml_node) ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/punchblock/component/output.rb', line 25
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
37
38
39
40
41
42
|
# File 'lib/punchblock/component/output.rb', line 37
def rayo_attributes
{
'url' => url,
'content-type' => content_type
}
end
|
#rayo_children(root) ⇒ Object
44
45
46
47
|
# File 'lib/punchblock/component/output.rb', line 44
def rayo_children(root)
root.cdata xml_value
super
end
|
49
50
51
52
53
54
55
|
# File 'lib/punchblock/component/output.rb', line 49
def size
if ssml?
value.children.count
else
value.size
end
end
|
#ssml? ⇒ Boolean
57
58
59
|
# File 'lib/punchblock/component/output.rb', line 57
def ssml?
content_type == SSML_CONTENT_TYPE
end
|
#url ⇒ String
17
|
# File 'lib/punchblock/component/output.rb', line 17
attribute :url
|
#value ⇒ String, ...
23
|
# File 'lib/punchblock/component/output.rb', line 23
attribute :value
|