<commit_before>module FakeAWS
  module S3

    class RackApp
      def initialize(directory)
        @directory = directory
      end

      def call(env)
        request = Request.new(env)
        operation_for(request).call.to_rack_response
      end

    private

      def operation_for(request)
        operation_class(request).new(@directory, request)
      end

      def operation_class(request)
        case request.request_method
          when "PUT"
            get_put_operation_class(request)
          when "GET"
            Operations::GetObject
          else
            raise FakeAWS::UnsupportedRequestError
        end
      end

      def get_put_operation_class(request)
        case
          when request.has_key? then Operations::PutObject
                                else Operations::PutBucket
        end
      end

    end

  end
end
<commit_msg>use methods instead of string comparison<commit_after>module FakeAWS
  module S3

    class RackApp
      def initialize(directory)
        @directory = directory
      end

      def call(env)
        request = Request.new(env)
        operation_for(request).call.to_rack_response
      end

    private

      def operation_for(request)
        operation_class(request).new(@directory, request)
      end

      def operation_class(request)
        case
          when request.put?
            get_put_operation_class(request)
          when request.get?
            Operations::GetObject
          else
            raise FakeAWS::UnsupportedRequestError
        end
      end

      def get_put_operation_class(request)
        case
          when request.has_key?
           Operations::PutObject
          else
            Operations::PutBucket
        end
      end

    end

  end
end

{'fraction_non_alphanumeric': 0.05254237288135593, 'fraction_numerical': 0.0011299435028248588, 'mean_word_length': 1.7758620689655173, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1433731', 'n_tokens_mistral': 474, 'n_tokens_neox': 460, 'n_words': 107}