<commit_before>
/*!
 * Skeleton.js - Router
 * Copyright(c) 2012 <NAME> <<EMAIL>>
 * MIT Licensed
 */

define([
  'use!backbone',
  'config'
], function(Backbone, config){

  /**
   * Skeleton router definition
   */
  var Router = Backbone.Router.extend({

    start: function(options){
      // Set default options
      options || (options = {});
      if (typeof(options.root) == 'undefined')
        options.root = config.url.root;
      if (typeof(options.pushState) == 'undefined')
        options.pushState = true;

      Backbone.history.start(options);
    },

    /**
     * Generates a URL replacing the route params with the values of those
     * params in the specified object
     */
    generateRoute: function(route, params){
      return route.replace(/:(\w+)/g, function(match, paramName){
        return params[paramName];
      });
    },

    /**
     * Returns the current route
     */
    getCurrentRoute: function(){
      var current = Backbone.history.fragment,
          root = Backbone.history.options.root;
      // Fixes error in backbone
      if (root && current.indexOf(root) == 0){
        current = current.substr(root.length);
      }
      return current;<commit_msg>Added refresh method to router.<commit_after>
/*!
 * Skeleton.js - Router
 * Copyright(c) 2012 <NAME> <<EMAIL>>
 * MIT Licensed
 */

define([
  'use!backbone',
  'config'
], function(Backbone, config){

  /**
   * Skeleton router definition
   */
  var Router = Backbone.Router.extend({

    start: function(options){
      // Set default options
      options || (options = {});
      if (typeof(options.root) == 'undefined')
        options.root = config.url.root;
      if (typeof(options.pushState) == 'undefined')
        options.pushState = true;

      Backbone.history.start(options);
    },

    /**
     * Generates a URL replacing the route params with the values of those
     * params in the specified object
     */
    generateRoute: function(route, params){
      return route.replace(/:(\w+)/g, function(match, paramName){
        return params[paramName];
      });
    },

    /**
     * Returns the current route
     */
    getCurrentRoute: function(){
      var current = Backbone.history.fragment,
          root = Backbone.history.options.root;
      // Fixes error in backbone
      if (root && current.indexOf(root) == 0){
        current = current.substr(root.length);
      }
      return current;
    },

    /**
     * Triggers again the handler for the current route
     */
    refresh: function(){
      Backbone.history.loadUrl(this.getCurrentRoute());
{'fraction_non_alphanumeric': 0.13613575009641343, 'fraction_numerical': 0.0038565368299267257, 'mean_word_length': 2.444887118193891, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '7601947', 'n_tokens_mistral': 760, 'n_tokens_neox': 733, 'n_words': 188}