Module: FSR::Utils::DTMF

Defined in:
lib/fsr/utils/dtmf.rb

Constant Summary collapse

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}
]

Class Method Summary collapse

Class Method Details

.from_string(dtmf) ⇒ Object



16
17
18
19
20
# File 'lib/fsr/utils/dtmf.rb', line 16

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