Class: D2W::WordInNumber

Inherits:
Object
  • Object
show all
Defined in:
lib/d2w/word_in_number.rb

Instance Method Summary collapse

Instance Method Details

#word_in_number?(phone_no, word, dw_map) ⇒ Boolean

Returns:

  • (Boolean)


3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/d2w/word_in_number.rb', line 3

def word_in_number?(phone_no, word, dw_map)
  number = []
  word.split("").each do |char|
    dw_map.each do |k, v|
      if v.include?(char)
        number << k
        break
      end
    end
  end

  if phone_no.include?number.join("")
    return number.join("")
  end
end