Sha256: d0fab87e4e1cd60022b3818c3ef63c53baa6f190edfbde9475885bcb039839e9
Contents?: true
Size: 1.07 KB
Versions: 1
Compression:
Stored size: 1.07 KB
Contents
# encoding: utf-8 module Adhearsion class CallController module Input Result = Struct.new(:status, :mode, :confidence, :utterance, :interpretation, :nlsml) do def to_s utterance end def inspect "#<#{self.class} status=#{status.inspect}, confidence=#{confidence.inspect}, utterance=#{utterance.inspect}, interpretation=#{interpretation.inspect}, nlsml=#{nlsml.inspect}>" end def utterance=(other) self[:utterance] = mode == :dtmf ? parse_dtmf(other) : other end def match? status == :match end private def parse_dtmf(dtmf) return if dtmf.nil? || dtmf.empty? dtmf.split(' ').inject '' do |final, digit| final << parse_dtmf_digit(digit) end end # @private def parse_dtmf_digit(digit) case tone = digit.split('-').last when 'star' '*' when 'pound' '#' else tone end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
adhearsion-3.0.0.beta1 | lib/adhearsion/call_controller/input/result.rb |