title: private method called noMethodError ruby
body: <p>I've been trying to work the following problem out and ran into the error. The point of the problem is to use a given key sequence to encrypt a string. For example, when given "cat" and [1,2,3] the result should be "dcw" 
  Any suggestions? the error was the following</p>
  
  <pre><code>def vigenere_cipher(string, key_sequence)
    keyIndex=0
    string=string.each_char.map do |c|
      c=c.shift!(c,keyIndex)
      keyIndex+=1
      if keyIndex=key_sequence.length
        keyIndex=0
      end
    end
    return string
  end
  
  def shift!(c,keyIndex)
    alphabet = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
    inititalLetterIndex=alphabet.index(c)
    finalLetterIndex=alphabet[inititalLetterIndex+keyIndex]
    return alphabet[finalLetterIndex]
  end
  
  vigenere_cipher("cat", [1,2,3])
  # private method `shift!' called for "c":String (NoMethodError)
  </code></pre>