<commit_before># Makes decorators for various base model types.
module Odk
  class DecoratorFactory
    include Singleton

    def self.decorate(obj)
      instance.decorate(obj)
    end

    def self.decorate_collection(objs)
      objs.map { |obj| instance.decorate(obj) }
    end

    def decorate(obj)
      if obj.respond_to?(:decorated?) # used in testing
        return   obj
      end

      case obj.class.name
      when "Form"
        FormDecorator.decorate(obj)
      when "QingGroup"
        QingGroupDecorator.decorate(obj)
      when "Questioning"
        QingDecorator.decorate(obj)
      when "Condition"
        ConditionDecorator.decorate(obj)
      when "Subqing"
        SubqingDecorator.decorate(obj)
      when "Forms::ConditionGroup"
        ConditionGroupDecorator.decorate(obj)
      else
        obj
      end
    end
  end
end
<commit_msg>7200: fix most failing tests except those failing on 7180<commit_after># Makes decorators for various base model types.
module Odk
  class DecoratorFactory
    include Singleton

    def self.decorate(obj)
      instance.decorate(obj)
    end

    def self.decorate_collection(objs)
      objs.map { |obj| instance.decorate(obj) }
    end

    def decorate(obj)
      # if obj.respond_to?(:decorated?) # used in testing
      #   return   obj
      # end

      case obj.class.name
      when "Form"
        FormDecorator.decorate(obj)
      when "QingGroup"
        QingGroupDecorator.decorate(obj)
      when "Questioning"
        QingDecorator.decorate(obj)
      when "Condition"
        ConditionDecorator.decorate(obj)
      when "Subqing"
        SubqingDecorator.decorate(obj)
      when "Forms::ConditionGroup"
        ConditionGroupDecorator.decorate(obj)
      else
        obj
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.07511210762331838, 'fraction_numerical': 0.004484304932735426, 'mean_word_length': 2.3742911153119093, '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': '2963875', 'n_tokens_mistral': 574, 'n_tokens_neox': 558, 'n_words': 129}