<commit_before>require "godmin/resources/resource_service/associations"
require "godmin/resources/resource_service/batch_actions"
require "godmin/resources/resource_service/filters"
require "godmin/resources/resource_service/ordering"
require "godmin/resources/resource_service/pagination"
require "godmin/resources/resource_service/scopes"

module Godmin
  module Resources
    module ResourceService
      extend ActiveSupport::Concern

      include Associations
      include BatchActions
      include Filters
      include Ordering
      include Pagination
      include Scopes

      attr_reader :options

      def initialize(options = {})
        @options = options
      end

      def resource_class
        @options[:resource_class] || resource_class_name.constantize
      end

      def resource_class_name
        self.class.name.chomp("Service")
      end

      def resources_relation
        if options[:resource_parent].present?
          resource_class.where(options[:resource_parent].class.name.underscore => options[:resource_parent])
        else
          resource_class.all
        end
      end

      def resources(params)
        apply_pagination(
          params[:page], apply_order(
            params[:order], apply_filters(
              params[:filter], apply_scope(
                params[:scope], resources_relation
              )
            )
          )
        )<commit_msg>Remove unused service option that was added for test reasons (#242)<commit_after>require "godmin/resources/resource_service/associations"
require "godmin/resources/resource_service/batch_actions"
require "godmin/resources/resource_service/filters"
require "godmin/resources/resource_service/ordering"
require "godmin/resources/resource_service/pagination"
require "godmin/resources/resource_service/scopes"

module Godmin
  module Resources
    module ResourceService
      extend ActiveSupport::Concern

      include Associations
      include BatchActions
      include Filters
      include Ordering
      include Pagination
      include Scopes

      attr_reader :options

      def initialize(options = {})
        @options = options
      end

      def resource_class
        self.class.name.chomp("Service").constantize
      end

      def resources_relation
        if options[:resource_parent].present?
          resource_class.where(options[:resource_parent].class.name.underscore => options[:resource_parent])
        else
          resource_class.all
        end
      end

      def resources(params)
        apply_pagination(
          params[:page], apply_order(
            params[:order], apply_filters(
              params[:filter], apply_scope(
                params[:scope], resources_relation
              )
            )
          )
        )
{'fraction_non_alphanumeric': 0.0728643216080402, 'fraction_numerical': 0.0010768126346015793, 'mean_word_length': 2.6194805194805193, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '7544820', 'n_tokens_mistral': 710, 'n_tokens_neox': 683, 'n_words': 143}