refactor calculator.rb