<commit_before>require 'securerandom'

module DeviseMasquerade
  module Controllers

    module UrlHelpers
      def masquerade_path(resource, *args)
        scope = Devise::Mapping.find_scope!(resource)

        opts = args.shift || {}
        opts.merge!(masqueraded_resource_class: resource.class.name)

        opts.merge!(Devise.masquerade_param => resource.masquerade_key)

        send("#{scope}_masquerade_index_path", opts, *args)
      end

      def back_masquerade_path(resource, *args)
        scope = Devise::Mapping.find_scope!(resource)

        opts = args.first || {}
        opts.merge!(masqueraded_resource_class: resource.class.name)

        send("back_#{scope}_masquerade_index_path", opts, *args)
      end
    end

  end
end
<commit_msg>refactor: avoid Hash#merge! for 1 argument<commit_after>require 'securerandom'

module DeviseMasquerade
  module Controllers

    module UrlHelpers
      def masquerade_path(resource, *args)
        scope = Devise::Mapping.find_scope!(resource)

        opts = args.shift || {}
        opts[:masqueraded_resource_class] = resource.class.name

        opts[Devise.masquerade_param] = resource.masquerade_key

        send("#{scope}_masquerade_index_path", opts, *args)
      end

      def back_masquerade_path(resource, *args)
        scope = Devise::Mapping.find_scope!(resource)

        opts = args.first || {}
        opts[:masqueraded_resource_class] = resource.class.name

        send("back_#{scope}_masquerade_index_path", opts, *args)
      end
    end

  end
end

{'fraction_non_alphanumeric': 0.10423452768729642, 'fraction_numerical': 0.0006514657980456026, 'mean_word_length': 3.2548476454293627, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '7550937', 'n_tokens_mistral': 488, 'n_tokens_neox': 472, 'n_words': 83}