<commit_before>require "action_dispatch/http/request"
require "erb"
require "pathname"

module Autodoc
  class Document
    def self.render(*args)
      new(*args).render
    end

    def initialize(context)
      @context = context
    end

    def pathname
      @path ||= begin
        payload = @context.example.file_path.gsub(%r<\./spec/requests/(.+)_spec\.rb>, '\1.md')
        Pathname.new(Autodoc.configuration.path) + payload
      end
    end

    def render
      ERB.new(Autodoc.configuration.template, nil, "-").result(binding)
    end

    def title
      "#{method} #{path}"
    end

    def identifier
      title.gsub(" ", "-").gsub(/[:_\/]/, "").downcase
    end

    private<commit_msg>Fix fragment pattern in toc links<commit_after>require "action_dispatch/http/request"
require "erb"
require "pathname"

module Autodoc
  class Document
    def self.render(*args)
      new(*args).render
    end

    def initialize(context)
      @context = context
    end

    def pathname
      @path ||= begin
        payload = @context.example.file_path.gsub(%r<\./spec/requests/(.+)_spec\.rb>, '\1.md')
        Pathname.new(Autodoc.configuration.path) + payload
      end
    end

    def render
      ERB.new(Autodoc.configuration.template, nil, "-").result(binding)
    end

    def title
      "#{method} #{path}"
    end

    def identifier
      title.gsub(" ", "-").gsub(/[:\/]/, "").downcase
    end

    private
{'fraction_non_alphanumeric': 0.14415675297410777, 'fraction_numerical': 0.0013995801259622112, 'mean_word_length': 2.4541062801932365, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '7213009', 'n_tokens_mistral': 466, 'n_tokens_neox': 452, 'n_words': 100}