<commit_before>require "paperclip_storage_filesystem_versioned/version"
require "paperclip"

module Paperclip
  module Storage
    module FilesystemVersioned
      def self.extended base
        base.instance_eval do
          @version_proc = @options[:version_proc] || Proc.new { |attachment, style| attachment.instance.versions.count}

          unless @options[:url].to_s.match(/\/:version\//)
            @options[:url] = @options[:url].gsub(/\/:class\/:attachment\//, '/:class/:attachment/:version/')
          end

          unless @options[:path].to_s.match(/\/:version\//)
            @options[:path] = @options[:path].gsub(/\/:class\/:attachment\//, '/:class/:attachment/:version/')
          end
        end

        Paperclip.interpolates(:version) do |attachment, style|
          attachment.version_proc.call(attachment, style) if attachment.version_proc.is_a?(Proc)
        end unless Paperclip::Interpolations.respond_to? :version
      end

      def version_proc
        @version_proc
      end<commit_msg>version goes after id in path and url<commit_after>require "paperclip_storage_filesystem_versioned/version"
require "paperclip"

module Paperclip
  module Storage
    module FilesystemVersioned
      def self.extended base
        base.instance_eval do
          @version_proc = @options[:version_proc] || Proc.new { |attachment, style| attachment.instance.versions.count}

          unless @options[:url].to_s.match(/\/:version\//)
            @options[:url] = @options[:url].gsub(/\/:id_partition\//, '/:id_partition/:version/')
          end

          unless @options[:path].to_s.match(/\/:version\//)
            @options[:path] = @options[:path].gsub(/\/:id_partition\//, '/:id_partition/:version/')
          end
        end

        Paperclip.interpolates(:version) do |attachment, style|
          attachment.version_proc.call(attachment, style) if attachment.version_proc.is_a?(Proc)
        end unless Paperclip::Interpolations.respond_to? :version
      end

      def version_proc
        @version_proc
      end
{'fraction_non_alphanumeric': 0.1357421875, 'fraction_numerical': 0.0, 'mean_word_length': 2.7944444444444443, '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': '4323555', 'n_tokens_mistral': 594, 'n_tokens_neox': 597, 'n_words': 108}