<commit_before># encoding: utf-8

# Manage home page
class HomeController < ApplicationController
  def index
    @script = Forms::Script.new(ip: request.remote_ip)
  end

  def script
    @script = Forms::Script.new(script_params)
    if @script.valid?
      result(script_params[:action])
    else
      render
    end
  end

  # private

  def result(action)
    case action
    when 'compress' then
      render json: { response: @script.compress }
    when 'url' then
      render json: { response: script_params[:url].split.each_with_object([]) { |url, a| a << { url: url, result: @script.proxy(url) } } }
    else
      render json: { error: true }
    end
  end

  def script_params
    params.require(:forms_script).permit(:ip, :name, :action, :url)
  end
end
<commit_msg>don't allow access to private methods<commit_after># encoding: utf-8

# Manage home page
class HomeController < ApplicationController
  def index
    @script = Forms::Script.new(ip: request.remote_ip)
  end

  def script
    @script = Forms::Script.new(script_params)
    if @script.valid?
      result(script_params[:action])
    else
      render
    end
  end

  private

  def result(action)
    case action
    when 'compress' then
      render json: { response: @script.compress }
    when 'url' then
      render json: { response: script_params[:url].split.each_with_object([]) { |url, a| a << { url: url, result: @script.proxy(url) } } }
    else
      render json: { error: true }
    end
  end

  def script_params
    params.require(:forms_script).permit(:ip, :name, :action, :url)
  end
end

{'fraction_non_alphanumeric': 0.11616161616161616, 'fraction_numerical': 0.0012626262626262627, 'mean_word_length': 3.095607235142119, 'pattern_counts': {'":': 0, '<': 9, '<?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': '6940090', 'n_tokens_mistral': 515, 'n_tokens_neox': 501, 'n_words': 139}