<commit_before>class Roda
  module RodaPlugins
    module HeaderMatchers
      module RequestMethods
        def match_header(key)
          env[key.upcase.tr("-","_")]
        end

        # Useful for matching against the request host (i.e. HTTP_HOST).
        #
        # @example
        #   on host("account1.example.com"), "api" do
        #     res.write "You have reached the API of account1."
        #   end
        def match_host(hostname)
          hostname === host
        end

        # If you want to match against the HTTP_ACCEPT value.
        #
        # @example
        #   # HTTP_ACCEPT=application/xml
        #   on accept("application/xml") do
        #     # automatically set to application/xml.
        #     res.write res["Content-Type"]
        #   end
        def match_accept(mimetype)
          if env["HTTP_ACCEPT"].to_s.split(',').any?{|s| s.strip == mimetype}
            response["Content-Type"] = mimetype
          end
        end
      end
    end

    register_plugin(:header_matchers, HeaderMatchers)<commit_msg>Make match_* methods added by header_matchers private<commit_after>class Roda
  module RodaPlugins
    module HeaderMatchers
      module RequestMethods
        private

        def match_header(key)
          env[key.upcase.tr("-","_")]
        end

        # Useful for matching against the request host (i.e. HTTP_HOST).
        #
        # @example
        #   on host("account1.example.com"), "api" do
        #     res.write "You have reached the API of account1."
        #   end
        def match_host(hostname)
          hostname === host
        end

        # If you want to match against the HTTP_ACCEPT value.
        #
        # @example
        #   # HTTP_ACCEPT=application/xml
        #   on accept("application/xml") do
        #     # automatically set to application/xml.
        #     res.write res["Content-Type"]
        #   end
        def match_accept(mimetype)
          if env["HTTP_ACCEPT"].to_s.split(',').any?{|s| s.strip == mimetype}
            response["Content-Type"] = mimetype
          end
        end
      end
    end

    register_plugin(:header_matchers, HeaderMatchers)
{'fraction_non_alphanumeric': 0.09838337182448037, 'fraction_numerical': 0.0018475750577367205, 'mean_word_length': 1.8020698576972833, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, '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': '6120236', 'n_tokens_mistral': 625, 'n_tokens_neox': 614, 'n_words': 156}