<commit_before>require 'action_controller'
require 'action_controller/test_process'

module Micronaut
  module Rails
    module Controllers

      module InstanceMethods
        attr_reader :request, :response, :controller

        def route_for(options)
          ActionController::Routing::Routes.reload if ActionController::Routing::Routes.empty?
          ActionController::Routing::Routes.generate(options)
        end

        def params_from(method, path)
          ActionController::Routing::Routes.reload if ActionController::Routing::Routes.empty?
          ActionController::Routing::Routes.recognize_path(path, :method => method)
        end

      end

      module TemplateIsolationExtensions
        def file_exists?(ignore); true; end
        
        def render_file(*args)
          @first_render ||= args[0] unless args[0] =~ /^layouts/
        end
        
        def render(*args)
          return super if Hash === args.last && args.last[:inline]
          record_render(args[0])
        end
      
      private
      
        def record_render(opts)
          @_rendered ||= {}
          (@_rendered[:template] ||= opts[:file]) if opts[:file]
          (@_rendered[:partials][opts[:partial]] += 1) if opts[:partial]<commit_msg>Recording a partial render when partials option is set.<commit_after>require 'action_controller'
require 'action_controller/test_process'

module Micronaut
  module Rails
    module Controllers

      module InstanceMethods
        attr_reader :request, :response, :controller

        def route_for(options)
          ActionController::Routing::Routes.reload if ActionController::Routing::Routes.empty?
          ActionController::Routing::Routes.generate(options)
        end

        def params_from(method, path)
          ActionController::Routing::Routes.reload if ActionController::Routing::Routes.empty?
          ActionController::Routing::Routes.recognize_path(path, :method => method)
        end

      end

      module TemplateIsolationExtensions
        def file_exists?(ignore); true; end
        
        def render_file(*args)
          @first_render ||= args[0] unless args[0] =~ /^layouts/
        end
        
        def render(*args)
          return super if Hash === args.last && args.last[:inline]
          record_render(args[0])
        end
      
      private
      
        def record_render(opts)
          @_rendered ||= {}
          (@_rendered[:template] ||= opts[:file]) if opts[:file]
          if opts[:partial]
            @_rendered[:partials][opts[:partial]] ||= 0
            @_rendered[:partials][opts[:partial]] += 1
          end
{'fraction_non_alphanumeric': 0.107006854531607, 'fraction_numerical': 0.003427265803503427, 'mean_word_length': 2.559620596205962, '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': '4132489', 'n_tokens_mistral': 706, 'n_tokens_neox': 701, 'n_words': 150}