<commit_before>class RepositoriesController < ApplicationController
  respond_to :json

  def index
    respond_with(repositories)
  end

  def show
    respond_to do |format|
      format.json do
        render :json => repository
      end
      format.png do
        response.headers["Expires"] = CGI.rfc1123_date(Time.now)
        send_file(status_image_path, :type => 'image/png', :disposition => 'inline')
      end
    end
  end

  protected

    def repository
      Repository.find(params[:id])
    end

    def repositories
      repos = if params[:owner_name]
          Repository.where(:owner_name => params[:owner_name]).timeline
        else
          Repository.timeline.recent
        end

      params[:search].present? ? repos.search(params[:search]) : repos
    end

    def status_image_path
      status = Repository.human_status_by(params.slice(:owner_name, :name))
      "#{Rails.public_path}/images/status/#{status}.png"
    end

end<commit_msg>minor repo controller cleanup<commit_after>class RepositoriesController < ApplicationController
  respond_to :json

  def index
    respond_with(repositories)
  end

  def show
    respond_with(repository) do |format|
      format.png { send_status_image_file }
    end
  end

  protected

    def repository
      Repository.find(params[:id])
    end

    def repositories
      repos = if params[:owner_name]
          Repository.where(:owner_name => params[:owner_name]).timeline
        else
          Repository.timeline.recent
        end

      params[:search].present? ? repos.search(params[:search]) : repos
    end

    def send_status_image_file
      status = Repository.human_status_by(params.slice(:owner_name, :name))
      path   = "#{Rails.public_path}/images/status/#{status}.png"

      response.headers["Expires"] = CGI.rfc1123_date(Time.now)

      send_file(path, :type => 'image/png', :disposition => 'inline')
    end

end
{'fraction_non_alphanumeric': 0.10182767624020887, 'fraction_numerical': 0.004177545691906005, 'mean_word_length': 2.918200408997955, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 10, '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': '6948626', 'n_tokens_mistral': 600, 'n_tokens_neox': 559, 'n_words': 114}