<commit_before>module ActiveRecord #:nodoc:
  module Acts #:nodoc:
    module SoftDeleteByField
      DEFAULT_FIELD_NAME = :deleted_at

      def self.included(base)
        base.send :extend, ClassMethods
      end

      module ClassMethods

        def soft_delete_by_field_name
          @soft_delete_by_field_name || parents_soft_delete_by_field_name || DEFAULT_FIELD_NAME
        end

        def soft_delete_by_field_name=(field_name)
          @soft_delete_by_field_name = field_name.to_sym
        end

        def acts_as_soft_delete_by_field(field_name = DEFAULT_FIELD_NAME)
          attr_accessor :reasons_not_to_delete
          self.soft_delete_by_field_name = field_name
          send :include, SoftDeleteByField::InstanceMethods
          scope :extant, where(arel_table[soft_delete_by_field_name].eq(nil))
          scope :deleted, where(arel_table[soft_delete_by_field_name].not_eq(nil))
        end

        def soft_delete_class_table_name
          (self.class.name.tableize + ".") if self.class.kind_of?(SoftDeleteByField)
        end

        def parents_soft_delete_by_field_name
          self.superclass.soft_delete_by_field_name if self.superclass.respond_to? :soft_delete_by_field_name
        end
  
      end

      module InstanceMethods

<commit_msg>Small refactor of parents_soft_delete_by_field method<commit_after>module ActiveRecord #:nodoc:
  module Acts #:nodoc:
    module SoftDeleteByField
      DEFAULT_FIELD_NAME = :deleted_at

      def self.included(base)
        base.send :extend, ClassMethods
      end

      module ClassMethods

        def soft_delete_by_field_name
          @soft_delete_by_field_name || parents_soft_delete_by_field_name || DEFAULT_FIELD_NAME
        end

        def soft_delete_by_field_name=(field_name)
          @soft_delete_by_field_name = field_name.to_sym
        end

        def acts_as_soft_delete_by_field(field_name = DEFAULT_FIELD_NAME)
          attr_accessor :reasons_not_to_delete
          self.soft_delete_by_field_name = field_name
          send :include, SoftDeleteByField::InstanceMethods
          scope :extant, where(arel_table[soft_delete_by_field_name].eq(nil))
          scope :deleted, where(arel_table[soft_delete_by_field_name].not_eq(nil))
        end

        def soft_delete_class_table_name
          (self.class.name.tableize + ".") if self.class.kind_of?(SoftDeleteByField)
        end

        def parents_soft_delete_by_field_name
          superclass.soft_delete_by_field_name if superclass.respond_to? :soft_delete_by_field_name
        end
  
      end

      module InstanceMethods


{'fraction_non_alphanumeric': 0.057736720554272515, 'fraction_numerical': 0.0, 'mean_word_length': 3.0672926447574334, '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': '6059202', 'n_tokens_mistral': 814, 'n_tokens_neox': 800, 'n_words': 128}