<commit_before>module ActiveAdmin
  module Dashboards

    autoload :DashboardController,  'active_admin/dashboards/dashboard_controller'
    autoload :Section,              'active_admin/dashboards/section'

    @@sections = {}
    mattr_accessor :sections

    class << self

      # Eval an entire block in the context of this module to build 
      # dashboards quicker. 
      #
      # Example:
      #
      #   ActiveAdmin::Dashboards.build do
      #     section "Recent Post" do
      #       # return a list of posts
      #     end
      #   end
      #
      def build(&block)
        module_eval(&block)
      end

      # Add a new dashboard section to a namespace. If no namespace is given
      # it will be added to the default namespace.
      def add_section(name, options = {}, &block)
        namespace = options.delete(:namespace) || ActiveAdmin.default_namespace
        self.sections[namespace] ||= [] 
        self.sections[namespace] << Section.new(namespace, name, options, &block)
        self.sections[namespace].sort!
      end
      alias_method :section, :add_section

      def sections_for_namespace(namespace)
        @@sections[namespace] || []
      end

      def clear_all_sections!
        @@sections = {}
      end

    end

  end
end
<commit_msg>FIX: ActiveAdmin::Dashboards#add_section: default to :root namespace if ActiveAdmin.default_namespace is set to false, otherwise DashboardController#index will never figure them out<commit_after>module ActiveAdmin
  module Dashboards

    autoload :DashboardController,  'active_admin/dashboards/dashboard_controller'
    autoload :Section,              'active_admin/dashboards/section'

    @@sections = {}
    mattr_accessor :sections

    class << self

      # Eval an entire block in the context of this module to build 
      # dashboards quicker. 
      #
      # Example:
      #
      #   ActiveAdmin::Dashboards.build do
      #     section "Recent Post" do
      #       # return a list of posts
      #     end
      #   end
      #
      def build(&block)
        module_eval(&block)
      end

      # Add a new dashboard section to a namespace. If no namespace is given
      # it will be added to the default namespace.
      def add_section(name, options = {}, &block)
        namespace = options.delete(:namespace) || ActiveAdmin.default_namespace || :root
        self.sections[namespace] ||= [] 
        self.sections[namespace] << Section.new(namespace, name, options, &block)
        self.sections[namespace].sort!
      end
      alias_method :section, :add_section

      def sections_for_namespace(namespace)
        @@sections[namespace] || []
      end

      def clear_all_sections!
        @@sections = {}
      end

    end

  end
end

{'fraction_non_alphanumeric': 0.08566243194192377, 'fraction_numerical': 0.0, 'mean_word_length': 2.3527980535279807, 'pattern_counts': {'":': 0, '<': 11, '<?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': '7196147', 'n_tokens_mistral': 770, 'n_tokens_neox': 735, 'n_words': 213}