<commit_before>module MetaModel

  class CocoaModel
    attr_reader :name
    attr_reader :properties

    def initialize(name)
      @name = name
      @properties = []

      validate
    end

    def properties_exclude_id
      @properties.select { |property| property.key != :id }
    end

    def table_name
      name.to_s.tableize
    end

    def relation_name
      "#{name}Relation"
    end

    def validate
      property_keys = @properties.map { |property| property.key }

      unless property_keys.include? :id
        property_id = CocoaProperty.new(:id, :int, :primary)
        @properties << property_id
      end
    end

    def property_key_value_pairs
      @properties.map { |property| "#{property.key.to_s}: #{property.key.to_s}" }.join(", ")
    end

    def property_key_type_pairs
      @properties.map { |property| "#{property.key.to_s}: #{property.type.to_s}" }.join(", ")
    end

    def property_exclude_id_key_value_pairs
      return = properties_exclude_id.map { |property| "#{property.key.to_s}: #{property.key.to_s}" }.join(", ")
      return result.length > 0 ? ", #{result}" : ""
    end

    def property_exclude_id_key_type_pairs
      result = properties_exclude_id.map { |property| "#{property.key.to_s}: #{property.type.to_s}" }.join(", ")
      return result.length > 0 ? ", #{result}" : ""
    end

    def build_table
      table = ""
      @properties.each do |property|
        property_key = property.key
        if property.has_default_value?
          default_value = property.default_value
          if default_value.is_a? String
            table << "t.column(#{property_key}, defaultValue: \"#{default_value}\")\n\t\t\t"
          else
            table << "t.column(#{property_key}, defaultValue: #{default_value})\n\t\t\t"
          end
        else
          table << "t.column(#{property_key})\n\t\t\t"
        end
        table << "t.primaryKey(#{property_key})\n\t\t\t" if property.is_primary?
        table << "t.unique(#{property_key})\n\t\t\t" if property.is_unique?
      end
      table
    end
  end

end<commit_msg>fixed typo in cocoa model<commit_after>module MetaModel

  class CocoaModel
    attr_reader :name
    attr_reader :properties

    def initialize(name)
      @name = name
      @properties = []

      validate
    end

    def properties_exclude_id
      @properties.select { |property| property.key != :id }
    end

    def table_name
      name.to_s.tableize
    end

    def relation_name
      "#{name}Relation"
    end

    def validate
      property_keys = @properties.map { |property| property.key }

      unless property_keys.include? :id
        property_id = CocoaProperty.new(:id, :int, :primary)
        @properties << property_id
      end
    end

    def property_key_value_pairs
      @properties.map { |property| "#{property.key.to_s}: #{property.key.to_s}" }.join(", ")
    end

    def property_key_type_pairs
      @properties.map { |property| "#{property.key.to_s}: #{property.type.to_s}" }.join(", ")
    end

    def property_exclude_id_key_value_pairs
      result = properties_exclude_id.map { |property| "#{property.key.to_s}: #{property.key.to_s}" }.join(", ")
      return result.length > 0 ? ", #{result}" : ""
    end

    def property_exclude_id_key_type_pairs
      result = properties_exclude_id.map { |property| "#{property.key.to_s}: #{property.type.to_s}" }.join(", ")
      return result.length > 0 ? ", #{result}" : ""
    end

    def build_table
      table = ""
      @properties.each do |property|
        property_key = property.key
        if property.has_default_value?
          default_value = property.default_value
          if default_value.is_a? String
            table << "t.column(#{property_key}, defaultValue: \"#{default_value}\")\n\t\t\t"
          else
            table << "t.column(#{property_key}, defaultValue: #{default_value})\n\t\t\t"
          end
        else
          table << "t.column(#{property_key})\n\t\t\t"
        end
        table << "t.primaryKey(#{property_key})\n\t\t\t" if property.is_primary?
        table << "t.unique(#{property_key})\n\t\t\t" if property.is_unique?
      end
      table
    end
  end

end
{'fraction_non_alphanumeric': 0.13403542364767831, 'fraction_numerical': 0.0009573958831977022, 'mean_word_length': 2.491228070175439, 'pattern_counts': {'":': 0, '<': 27, '<?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': '4021413', 'n_tokens_mistral': 1378, 'n_tokens_neox': 1343, 'n_words': 265}