Class: Punchblock::Component::Input::Grammar
- Inherits:
-
RayoNode
- Object
- Niceogiri::XML::Node
- RayoNode
- Punchblock::Component::Input::Grammar
- Defined in:
- lib/punchblock/component/input.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from RayoNode
#call_id, #client, #component_id, #connection, #original_component
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
221 222 223 224 225 226 227 228 229 230 231 |
# File 'lib/punchblock/component/input.rb', line 221 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.
236 237 238 |
# File 'lib/punchblock/component/input.rb', line 236 def content_type read_attr 'content-type' end |
#content_type=(content_type) ⇒ Object
243 244 245 |
# File 'lib/punchblock/component/input.rb', line 243 def content_type=(content_type) write_attr 'content-type', content_type || 'application/grammar+grxml' end |
#eql?(o, *fields) ⇒ true, false
Compare two Choices objects by content type, and value
264 265 266 |
# File 'lib/punchblock/component/input.rb', line 264 def eql?(o, *fields) super o, *(fields + [:content_type, :value]) end |
#inspect_attributes ⇒ Object
:nodoc:
268 269 270 |
# File 'lib/punchblock/component/input.rb', line 268 def inspect_attributes # :nodoc: [:content_type, :value] + super end |
#value ⇒ String
Returns the choices available.
249 250 251 |
# File 'lib/punchblock/component/input.rb', line 249 def value content end |
#value=(value) ⇒ Object
255 256 257 258 259 |
# File 'lib/punchblock/component/input.rb', line 255 def value=(value) Nokogiri::XML::Builder.with(self) do |xml| xml.cdata " #{value} " end end |