<commit_before>
require 'wab/impl/handler'
require 'wab/impl/model'

module WAB
  module Impl

    # The shell for reference Ruby implementation.
    class Shell
      include WAB::ShellLogger
      extend Forwardable

      # Returns the path where a data type is located. The default is 'kind'.
      attr_reader :type_key
      attr_reader :path_pos

      attr_accessor :indent
      
      # Call the Model instance with these methods.
      def_delegators :@model, :get, :query

      # Sets up the shell with the supplied configuration data.
      #
      # config:: Configuration object
      def initialize(config)
        @indent       = config['indent'].to_i || 0
        @pre_path     = config[:path_prefix] || '/v1'
        @path_pos     = @pre_path.split('/').length - 1
        base          = config[:base] || '.'
        @model        = Model.new((config['store.dir'] || File.join(base, 'data')).gsub('$BASE', base), indent)
        @type_key     = config[:type_key] || 'kind'
        @logger       = config[:logger]
        @logger.level = config[:verbosity] unless @logger.nil?
        @http_dir     = (config['http.dir'] || File.join(base, 'pages')).gsub('$BASE', base)
        @http_port    = (config['http.port'] || 6363).to_i
        @export_proxy = config['export_proxy']
        @export_proxy = true if @export_proxy.nil? # The default is true if not present.
        @controllers  = {}

        requires      = config[:require]
        case requires<commit_msg>Change string keys to symbols<commit_after>
require 'wab/impl/handler'
require 'wab/impl/model'

module WAB
  module Impl

    # The shell for reference Ruby implementation.
    class Shell
      include WAB::ShellLogger
      extend Forwardable

      # Returns the path where a data type is located. The default is 'kind'.
      attr_reader :type_key
      attr_reader :path_pos

      attr_accessor :indent
      
      # Call the Model instance with these methods.
      def_delegators :@model, :get, :query

      # Sets up the shell with the supplied configuration data.
      #
      # config:: Configuration object
      def initialize(config)
        @indent       = config[:indent].to_i || 0
        @pre_path     = config[:path_prefix] || '/v1'
        @path_pos     = @pre_path.split('/').length - 1
        base          = config[:base] || '.'
        @model        = Model.new((config['store.dir'] || File.join(base, 'data')).gsub('$BASE', base), indent)
        @type_key     = config[:type_key] || 'kind'
        @logger       = config[:logger]
        @logger.level = config[:verbosity] unless @logger.nil?
        @http_dir     = (config['http.dir'] || File.join(base, 'pages')).gsub('$BASE', base)
        @http_port    = (config['http.port'] || 6363).to_i
        @export_proxy = config[:export_proxy]
        @export_proxy = true if @export_proxy.nil? # The default is true if not present.
        @controllers  = {}

        requires      = config[:require]
        case requires
{'fraction_non_alphanumeric': 0.12382864792503347, 'fraction_numerical': 0.004685408299866131, 'mean_word_length': 2.347144456886898, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3703440', 'n_tokens_mistral': 885, 'n_tokens_neox': 868, 'n_words': 237}