<commit_before>require 'action_dispatch'

module Irwi::Support::RouteMapper

  # Defining wiki root mount point
  def wiki_root( root, config = {} )
    opts = {
      :controller => 'wiki_pages',
      :root => root
    }.merge(config)

    Irwi.config.system_pages.each do |page_action, page_path| # Adding routes for system pages
      get( "#{root}/#{page_path}", opts.merge({ :action => page_action }) )
    end

    get( "#{root}/compare/(*path)", opts.merge({ :action => 'compare', :as => 'compare_wiki_page' }) ) # Comparing two versions of page
    get( "#{root}/new/(*path)", opts.merge({ :action => 'new', :as => 'new_wiki_page' }) ) # Wiki new route
    get( "#{root}/edit/(*path)", opts.merge({ :action => 'edit', :as => 'edit_wiki_page' }) ) # Wiki edit route
    get( "#{root}/history/(*path)", opts.merge({ :action => 'history', :as => 'history_wiki_page' }) ) # Wiki history route

    # Attachments
    post("#{root}/attach/(*path)", opts.merge({:action => 'add_attachment' }))
    delete("#{root}/attach/:attachment_id", opts.merge({:action => 'remove_attachment' }))

    delete( "#{root}/(*path)", opts.merge({ :action => 'destroy', :as => 'destroy_wiki_page' }) ) # Wiki destroy route
    post( "#{root}/(*path)", opts.merge({ :action => 'update', :as => 'update_wiki_page' }) ) # Save wiki pages route
    get( "#{root}/(*path)", opts.merge({ :action => 'show', :as => 'wiki_page' }) ) # Wiki pages route
  end
<commit_msg>fix for RuntimeError (can't modify frozen String) in routing when using rails 3.2<commit_after>require 'action_dispatch'

module Irwi::Support::RouteMapper

  # Defining wiki root mount point
  def wiki_root( root, config = {} )
    opts = {
      :controller => 'wiki_pages',
      :root => root
    }.merge(config)

    Irwi.config.system_pages.each do |page_action, page_path| # Adding routes for system pages
      get( "#{root}/#{page_path}", opts.merge({ :action => page_action.dup }) )
    end

    get( "#{root}/compare/(*path)", opts.merge({ :action => 'compare', :as => 'compare_wiki_page' }) ) # Comparing two versions of page
    get( "#{root}/new/(*path)", opts.merge({ :action => 'new', :as => 'new_wiki_page' }) ) # Wiki new route
    get( "#{root}/edit/(*path)", opts.merge({ :action => 'edit', :as => 'edit_wiki_page' }) ) # Wiki edit route
    get( "#{root}/history/(*path)", opts.merge({ :action => 'history', :as => 'history_wiki_page' }) ) # Wiki history route

    # Attachments
    post("#{root}/attach/(*path)", opts.merge({:action => 'add_attachment' }))
    delete("#{root}/attach/:attachment_id", opts.merge({:action => 'remove_attachment' }))

    delete( "#{root}/(*path)", opts.merge({ :action => 'destroy', :as => 'destroy_wiki_page' }) ) # Wiki destroy route
    post( "#{root}/(*path)", opts.merge({ :action => 'update', :as => 'update_wiki_page' }) ) # Save wiki pages route
    get( "#{root}/(*path)", opts.merge({ :action => 'show', :as => 'wiki_page' }) ) # Wiki pages route
  end

{'fraction_non_alphanumeric': 0.21086369770580296, 'fraction_numerical': 0.0006747638326585695, 'mean_word_length': 4.103270223752151, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 41, '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': '646645', 'n_tokens_mistral': 979, 'n_tokens_neox': 952, 'n_words': 242}