<commit_before>module Carnival
  class Action
    include Rails.application.routes.url_helpers
    PARTIAL_DEFAULT = :default
    PARTIAL_DELETE = :delete
    PARTIAL_REMOTE = :remote

    def initialize(name, params={})
      @name = name
      @params = params
      @partial = default_partial
      @path = params[:path] if params[:path].present?
    end

    def path(presenter, extra_params={})
      if @path.nil?
        params = {controller: presenter.controller_name, action: @name}
      elsif !@path[:controller].nil?
        params = @path
      else
        params = {path: @path}
      end
      params = params.merge(extra_params) if extra_params.present?
      params = params.merge(:only_path => true)<commit_msg>Allow a custom controller be specified in a action<commit_after>module Carnival
  class Action
    include Rails.application.routes.url_helpers
    PARTIAL_DEFAULT = :default
    PARTIAL_DELETE = :delete
    PARTIAL_REMOTE = :remote

    def initialize(name, params={})
      @name = name
      @params = params
      @partial = default_partial
      @path = params[:path] if params[:path].present?
      @controller = params[:controller]
    end

    def path(presenter, extra_params={})
      if @path.nil?
        params = {controller: @controller || presenter.controller_name, action: @name}
      elsif !@path[:controller].nil?
        params = @path
      else
        params = {path: @path}
      end
      params = params.merge(extra_params) if extra_params.present?
      params = params.merge(:only_path => true)
{'fraction_non_alphanumeric': 0.1056701030927835, 'fraction_numerical': 0.0, 'mean_word_length': 2.8825, 'pattern_counts': {'":': 0, '<': 3, '<?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': '7434202', 'n_tokens_mistral': 459, 'n_tokens_neox': 445, 'n_words': 114}