Class: AdhearsionASR::MenuBuilder::Matcher
- Inherits:
-
Struct
- Object
- Struct
- AdhearsionASR::MenuBuilder::Matcher
- Defined in:
- lib/adhearsion-asr/menu_builder.rb
Instance Method Summary collapse
- #apply_to_grammar(grammar) ⇒ Object
- #calculate_possible_options ⇒ Object
- #dispatch(controller, utterance) ⇒ Object
Instance Method Details
#apply_to_grammar(grammar) ⇒ Object
112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/adhearsion-asr/menu_builder.rb', line 112 def apply_to_grammar(grammar) = if .count > 1 grammar.one_of do .each do |key| item { key.to_s } end end else keys.first.to_s end end |
#calculate_possible_options ⇒ Object
125 126 127 |
# File 'lib/adhearsion-asr/menu_builder.rb', line 125 def keys.map { |key| key.respond_to?(:to_a) ? key.to_a : key }.flatten end |
#dispatch(controller, utterance) ⇒ Object
104 105 106 107 108 109 110 |
# File 'lib/adhearsion-asr/menu_builder.rb', line 104 def dispatch(controller, utterance) if payload.is_a?(Proc) controller.instance_exec utterance, &payload else controller.invoke payload, extension: utterance end end |