<commit_before># require 'procedo/procedure/product_parameter'
# require 'procedo/procedure/group_parameter'

module Procedo
  # This class represents a procedure
  class Procedure
    ROOT_NAME = 'root_'.freeze

    attr_reader :id, :name, :categories, :mandatory_actions, :optional_actions
    delegate :add_product_parameter, :add_group_parameter, :find, :find!,
             :each_product_parameter, :each_group_parameter, :each_parameter,
             :product_parameters, :group_parameters,
             :position_of, :parameters_of_type, to: :root_group

    class << self
      def find(name)
        Procedo.find(name)
      end

      def find_each(&block)
        Procedo.procedures.each(&block)
      end

      # Returns procedures of given activity families
      def activity_family(*families)
        options = categories.extract_options!
        select(options) do |p|
          p.of_activity_family?(*families)
        end
      end

      # Returns procedures of given categories
      def of_category(*categories)
        options = categories.extract_options!
        select(options) do |p|
          p.of_category?(*categories)
        end
      end

      # Returns procedures which main category match given ones
      def of_main_category(*categories)
        options = categories.extract_options!
        select(options) do |p|
          categories.detect { |c| p.categories.first <= c }
        end
      end

      # Select procedures with given block
      def select(options = {})
        include_deprecated = options[:include_deprecated]
        Procedo.procedures.select do |p|
          (include_deprecated || (!include_deprecated && !p.deprecated?)) &&
            yield(p)
        end<commit_msg>Fixes scope #of_activity_family on Procedo::Procedure<commit_after># require 'procedo/procedure/product_parameter'
# require 'procedo/procedure/group_parameter'

module Procedo
  # This class represents a procedure
  class Procedure
    ROOT_NAME = 'root_'.freeze

    attr_reader :id, :name, :categories, :mandatory_actions, :optional_actions
    delegate :add_product_parameter, :add_group_parameter, :find, :find!,
             :each_product_parameter, :each_group_parameter, :each_parameter,
             :product_parameters, :group_parameters,
             :position_of, :parameters_of_type, to: :root_group

    class << self
      def find(name)
        Procedo.find(name)
      end

      def find_each(&block)
        Procedo.procedures.each(&block)
      end

      # Returns procedures of given activity families
      def of_activity_family(*families)
        options = families.extract_options!
        select(options) do |p|
          p.of_activity_family?(*families)
        end
      end

      # Returns procedures of given categories
      def of_category(*categories)
        options = categories.extract_options!
        select(options) do |p|
          p.of_category?(*categories)
        end
      end

      # Returns procedures which main category match given ones
      def of_main_category(*categories)
        options = categories.extract_options!
        select(options) do |p|
          categories.detect { |c| p.categories.first <= c }
        end
      end

      # Select procedures with given block
      def select(options = {})
        include_deprecated = options[:include_deprecated]
        Procedo.procedures.select do |p|
          (include_deprecated || (!include_deprecated && !p.deprecated?)) &&
            yield(p)
        end
{'fraction_non_alphanumeric': 0.08597543558983148, 'fraction_numerical': 0.0, 'mean_word_length': 2.6747114375655823, 'pattern_counts': {'":': 0, '<': 9, '<?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': '7453043', 'n_tokens_mistral': 976, 'n_tokens_neox': 952, 'n_words': 233}