<commit_before># encoding: UTF-8
module Wice
  class <<self
    # Used in routes.rb to define routes to the query processing controller.
    # Parameters:
    # * map - the mapper object used in routes.rb to defined routes (instance of <tt>ActionController::Routing::RouteSet::Mapper</tt>)
    # * controller - name of the query processing controller, i.e.  <tt>'queries'</tt> if the controller is +QueriesController+ .
    # Read section "Saving Queries How-To" in README for more details.
    def define_routes(map, controller)
      controller = controller.to_s

      map.match '/wice_grid_serialized_queries/:grid_name',
        :to => "#{controller}#create",
        :as => 'create_serialized_query'

      map.match '/wice_grid_serialized_queries/:grid_name/:id',
        :to => "#{controller}#delete",
        :as => 'delete_serialized_query'
    end
  end

  module SerializedQueriesControllerMixin   #:nodoc:

    def delete  #:nodoc:
      init
      if sq = @query_store_model.find_by_id_and_grid_name(params[:id], @grid_name)
        if sq.destroy
          if params[:current]
            @current = @query_store_model.find_by_id_and_grid_name(params[:current], @grid_name)<commit_msg>map.match -> map.get<commit_after># encoding: UTF-8
module Wice
  class <<self
    # Used in routes.rb to define routes to the query processing controller.
    # Parameters:
    # * map - the mapper object used in routes.rb to defined routes (instance of <tt>ActionController::Routing::RouteSet::Mapper</tt>)
    # * controller - name of the query processing controller, i.e.  <tt>'queries'</tt> if the controller is +QueriesController+ .
    # Read section "Saving Queries How-To" in README for more details.
    def define_routes(map, controller)
      controller = controller.to_s

      map.get '/wice_grid_serialized_queries/:grid_name',
        :to => "#{controller}#create",
        :as => 'create_serialized_query'

      map.get '/wice_grid_serialized_queries/:grid_name/:id',
        :to => "#{controller}#delete",
        :as => 'delete_serialized_query'
    end
  end

  module SerializedQueriesControllerMixin   #:nodoc:

    def delete  #:nodoc:
      init
      if sq = @query_store_model.find_by_id_and_grid_name(params[:id], @grid_name)
        if sq.destroy
          if params[:current]
            @current = @query_store_model.find_by_id_and_grid_name(params[:current], @grid_name)
{'fraction_non_alphanumeric': 0.11245314452311538, 'fraction_numerical': 0.0008329862557267805, 'mean_word_length': 3.383211678832117, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 20, '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': '6032133', 'n_tokens_mistral': 751, 'n_tokens_neox': 745, 'n_words': 186}