Sha256: 1ed3b52cae8ab557690fa44f5e0051a4f073898c520a33bf03ad3704570808ab

Contents?: true

Size: 437 Bytes

Versions: 20

Compression:

Stored size: 437 Bytes

Contents

module FSR
  module Utils
    module DTMF
      MAP = Hash[ 
        [%w{a b c},
         %w{d e f},
         %w{g h i},
         %w{j k l},
         %w{m n o},
         %w{p q r s},
         %w{t u v},
         %w{w x y z}
        ].zip((2 .. 9).to_a)
      ]

      def self.from_string(dtmf)
        dtmf.each_char.map { |char|
          MAP[MAP.keys.detect { |k| k.include? char }] || char
        }.join
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
freeswitcher-0.8.0 lib/fsr/utils/dtmf.rb
freeswitcher-0.7.1 lib/fsr/utils/dtmf.rb
freeswitcher-0.7.0 lib/fsr/utils/dtmf.rb
freeswitcher-0.6.18 lib/fsr/utils/dtmf.rb
freeswitcher-0.6.17 lib/fsr/utils/dtmf.rb
freeswitcher-0.6.16 lib/fsr/utils/dtmf.rb
freeswitcher-0.6.15 lib/fsr/utils/dtmf.rb
freeswitcher-0.6.14 lib/fsr/utils/dtmf.rb
freeswitcher-0.6.13 lib/fsr/utils/dtmf.rb
freeswitcher-0.6.12 lib/fsr/utils/dtmf.rb
freeswitcher-0.6.11 lib/fsr/utils/dtmf.rb
freeswitcher-0.6.10 lib/fsr/utils/dtmf.rb
freeswitcher-0.6.9 lib/fsr/utils/dtmf.rb
freeswitcher-0.6.8 lib/fsr/utils/dtmf.rb
freeswitcher-0.6.7 lib/fsr/utils/dtmf.rb
freeswitcher-0.6.6 lib/fsr/utils/dtmf.rb
freeswitcher-0.6.5 lib/fsr/utils/dtmf.rb
freeswitcher-0.6.4 lib/fsr/utils/dtmf.rb
freeswitcher-0.6.3 lib/fsr/utils/dtmf.rb
freeswitcher-0.6.2 lib/fsr/utils/dtmf.rb