<commit_before>module Herd
  ASSETABLE_MODELS=[]
  module Assetable
    extend ActiveSupport::Concern

    included do
      ASSETABLE_MODELS.push(self)

      has_many :assets, -> {order(:position)},
        as:         :assetable,
        class_name: 'Herd::Asset',
        dependent:  :destroy,
        touch:      true

      has_many :master_assets, -> {master.order(:position)},
        as:         :assetable,
        class_name: 'Herd::Asset',
        dependent:  :destroy,
        touch:      true

      assetable_slug
    end

    def asset
      assets.master.take || self.class.missing_assets.take || Asset.new
    end

    def transforms
      self.class.transforms
    end

    def assets_missing
      assets.empty? ? self.class.missing_assets : assets
    end

    module ClassMethods
<commit_msg>Add convenience method Missing Assets to Assetable<commit_after>module Herd
  ASSETABLE_MODELS=[]
  module Assetable
    extend ActiveSupport::Concern

    included do
      ASSETABLE_MODELS.push(self)

      has_many :assets, -> {order(:position)},
        as:         :assetable,
        class_name: 'Herd::Asset',
        dependent:  :destroy,
        touch:      true

      has_many :master_assets, -> {master.order(:position)},
        as:         :assetable,
        class_name: 'Herd::Asset',
        dependent:  :destroy,
        touch:      true

      assetable_slug
    end

    def asset
      assets.master.take || self.class.missing_assets.take || Asset.new
    end

    def transforms
      self.class.transforms
    end

    def assets_missing
      assets.empty? ? self.class.missing_assets : assets
    end

    def missing_assets
      self.class.missing_assets
    end

    module ClassMethods

{'fraction_non_alphanumeric': 0.08906882591093117, 'fraction_numerical': 0.0, 'mean_word_length': 2.1684981684981683, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '393977', 'n_tokens_mistral': 526, 'n_tokens_neox': 500, 'n_words': 114}