<commit_before>class JsRoutes

  #
  # OPTIONS
  #

  DEFAULT_PATH = if Rails.version >= "3.1"
                   File.join('app','assets','javascripts','routes.js')
                 else
                   File.join('public','javascripts','routes.js')
                 end

  DEFAULTS = {
    :namespace => "Routes",
    :default_format => "",
    :exclude => [],
    :include => //,
    :file => DEFAULT_PATH,
    :prefix => ""
  }

  class Options < Struct.new(*DEFAULTS.keys)
    def to_hash
      Hash[*members.zip(values).flatten(1)]
    end
  end

  #
  # API
  #

  class << self
    def setup
      options.tap { |opts| yield(opts) if block_given? }
    end

    def options
      @options ||= Options.new.tap do |opts|
        DEFAULTS.each_pair {|k,v| opts[k] = v}
      end
    end

    def generate(opts = {})
      new(opts).generate
    end

    def generate!(opts = {})
      new(opts).generate!
    end
  end<commit_msg>symbolize_keys in to_hash to keep ruby 1.8.7 happy<commit_after>class JsRoutes

  #
  # OPTIONS
  #

  DEFAULT_PATH = if Rails.version >= "3.1"
                   File.join('app','assets','javascripts','routes.js')
                 else
                   File.join('public','javascripts','routes.js')
                 end

  DEFAULTS = {
    :namespace => "Routes",
    :default_format => "",
    :exclude => [],
    :include => //,
    :file => DEFAULT_PATH,
    :prefix => ""
  }

  class Options < Struct.new(*DEFAULTS.keys)
    def to_hash
      Hash[*members.zip(values).flatten(1)].symbolize_keys
    end
  end

  #
  # API
  #

  class << self
    def setup
      options.tap { |opts| yield(opts) if block_given? }
    end

    def options
      @options ||= Options.new.tap do |opts|
        DEFAULTS.each_pair {|k,v| opts[k] = v}
      end
    end

    def generate(opts = {})
      new(opts).generate
    end

    def generate!(opts = {})
      new(opts).generate!
    end
  end
{'fraction_non_alphanumeric': 0.14589823468328142, 'fraction_numerical': 0.004672897196261682, 'mean_word_length': 1.9330289193302892, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 17, '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': '3256807', 'n_tokens_mistral': 660, 'n_tokens_neox': 634, 'n_words': 126}