Class: Punchblock::Component::Input::Grammar
Constant Summary
Constants inherited from RayoNode
Instance Attribute Summary
Attributes inherited from RayoNode
#client, #component_id, #connection, #domain, #original_component, #target_call_id, #target_mixer_name
Class Method Summary collapse
Instance Method Summary collapse
-
#content_type ⇒ String
The choice content type.
- #content_type=(content_type) ⇒ Object
-
#eql?(o, *fields) ⇒ true, false
Compare two Choices objects by content type, and value.
-
#inspect_attributes ⇒ Object
:nodoc:.
-
#value ⇒ String
The choices available.
- #value=(value) ⇒ Object
Methods inherited from RayoNode
class_from_registration, import, #inspect, register, #source
Class Method Details
.new(options = {}) ⇒ Object
239 240 241 242 243 244 245 246 247 248 249 |
# File 'lib/punchblock/component/input.rb', line 239 def self.new( = {}) super(:grammar).tap do |new_node| case when Nokogiri::XML::Node new_node.inherit when Hash new_node.content_type = [:content_type] new_node.value = [:value] end end end |
Instance Method Details
#content_type ⇒ String
Returns the choice content type.
254 255 256 |
# File 'lib/punchblock/component/input.rb', line 254 def content_type read_attr 'content-type' end |
#content_type=(content_type) ⇒ Object
261 262 263 |
# File 'lib/punchblock/component/input.rb', line 261 def content_type=(content_type) write_attr 'content-type', content_type || grxml_content_type end |
#eql?(o, *fields) ⇒ true, false
Compare two Choices objects by content type, and value
290 291 292 |
# File 'lib/punchblock/component/input.rb', line 290 def eql?(o, *fields) super o, *(fields + [:content_type, :value]) end |
#inspect_attributes ⇒ Object
:nodoc:
294 295 296 |
# File 'lib/punchblock/component/input.rb', line 294 def inspect_attributes # :nodoc: [:content_type, :value] + super end |
#value ⇒ String
Returns the choices available.
267 268 269 270 271 272 273 |
# File 'lib/punchblock/component/input.rb', line 267 def value if grxml? RubySpeech::GRXML.import content else content end end |
#value=(value) ⇒ Object
277 278 279 280 281 282 283 284 285 |
# File 'lib/punchblock/component/input.rb', line 277 def value=(value) return unless value if grxml? && !value.is_a?(RubySpeech::GRXML::Element) value = RubySpeech::GRXML.import value end Nokogiri::XML::Builder.with(self) do |xml| xml.cdata " #{value} " end end |