Help with class extensions - RSPEC3 exercise


Regarding the caesar cipher question, my code passes the tests in the spec file.

class String
def caesar(shift)
self.each_byte.inject("") do |cipher, byte|
position = byte - “a”.ord
shifted = (position + shift) % 26

      cipher << ("a".ord + shifted).chr


However, the following error message appears in terminal.
/Users/James/aA Projects/James_Yoo/rspec3 exercise/lib/01_class_extensions.rb:105: warning: constant ::Fixnum is deprecated
/Users/James/aA Projects/James_Yoo/rspec3 exercise/spec/01_class_extensions_spec.rb:54: warning: constant ::Fixnum is deprecated
Run options: include {:locations=>{"./spec/01_class_extensions_spec.rb"=>[5]}}

I tried Googling this but wasn’t sure what is going on. Could anyone explain? Thanks!

The message is likely due to you running a newer version of Ruby that phases out the Fixnum class and uses the Integer class instead. It’s nothing to worry about for now. Nice job with the Caesar Cipher!

1 Like