title: In cryptography, a Caesar cipher Ruby
body: <p>In cryptography, there is a Caesar cipher. I am trying to build one in Ruby, but I don't know how to use capital letters in my range <code>('a'..'z').to_a.join</code>. How do I use capital letters?</p>
  
  <pre><code>class Caesar
  
  def initialize(shift)
    alphabet = ('a'..'z').to_a.join
  
  
    i = shift % alphabet.size
  
  
    @decrypt = alphabet
    @encrypt = alphabet[i..-1] + alphabet[0...i]
  end
  
  def encrypt(string)
    string.tr(@decrypt, @encrypt)
  end
  
  def decrypt(string)
    string.tr(@encrypt, @decrypt)
  end
  end
  
  cipher_1 = Caesar.new(1)
  s = 'A man, a plan, a canal: Panama!'
  puts s
  s_encoded = cipher_1.encrypt(s)
  puts s_encoded
  pudaats = cipher_1.decrypt(s_encoded)
  puts pudaats
  </code></pre>
  
  <p><strong>OUTput</strong></p>
  
  <blockquote>
    <p>A man, a plan, a canal: Panama!</p>
    
    <p>A nbo, b qmbo, b dbobm: Pbobnb!</p>
    
    <p>A man, a plan, a canal: Panama!</p>
  </blockquote>
  
  <p><strong>But i need Out Put</strong> </p>
  
  <blockquote>
    <p>A man, a plan, a canal: Panama!</p>
    
    <p>B nbo, b qmbo, b dbobm: Qbobnb!</p>
    
    <p>A man, a plan, a canal: Panama!</p>
  </blockquote>