In cryptography, a Caesar cipher, also called a shift cipher, encrypts a plaintext string by shifting the letters by a fixed number of positions shift_by. For example, if shift_by=3, then a shifts to d, b to e, x to a, A to D, and Z to C. Note that lowercase letters ‘wrap around', as do uppercase letters. Only upper- and lower-case letters are shifted; all other characters, including whitespace, punctuation, and digits, encode as themselves. Write a class CaesarCipher that gets constructed on the value shift_by. Its encode method encodes a string by shifting letters by shift_by positions, and its decode method decodes an encoded string.
>> cipher_1 = CaesarCipher.new(1)
>> s = 'A man, a plan, a canal: Panama!'
=> "A man, a plan, a canal: Panama!"
>> s_encoded = cipher_1.encode(s)
=> "B nbo, b qmbo, b dbobm: Qbobnb!"
>> cipher_1.decode(s_encoded)
=> "A man, a plan, a canal: Panama!"
>> cipher_12 = CaesarCipher.new(12)
>> cipher_12.encode(s)
=> "M ymz, m bxmz, m omzmx: Bmzmym!"
>> cipher_12.decode (cipher_12.encode(s))
=> "A man, a plan, a canal: Panama!"
>> cipher_12.decode(s_encoded)
=> "P bpc, p eapc, p rpcpa: Epcpbp!"
# s_encoded constructed with shift_by=1; wrong decoder!