<commit_before>module DNS
  class BaseRecord < DNS::Record
    attr :ttl_val
    attr :value
    attr_reader :name

    def initialize domain, name, *args, &block

      params = {}
      params = args.pop if args.last.is_a? Hash

      host = domain.host
      value = nil

      case args.size
        when 2
          host = args[0]
          value = args[1]
        when 1
          value = args[0]
        else
          raise 'Content must be define'
      end

      @name = name.to_sym
      @value = value
      params = {ttl: domain.ttl_val}.merge(params)

      params.each do |key, value|
        self.send "#{key}", value if self.respond_to? key
      end

      super domain, host, params
      instance_eval &block  if block_given?
    end

    def type
      self.name
    end

    def value
      if @value.to_s.include?(' ')
        '"' + @value.to_s + '"'
      else
        @value
      end
    end

    def ttl v
      @ttl_val = v
    end
  end<commit_msg>add priority for all record<commit_after>module DNS
  class BaseRecord < DNS::Record
    attr :ttl_val
    attr :value
    attr_reader :name

    def initialize domain, name, *args, &block

      params = {}
      params = args.pop if args.last.is_a? Hash

      host = domain.host
      value = nil

      case args.size
        when 2
          host = args[0]
          value = args[1]
        when 1
          value = args[0]
        else
          raise 'Content must be define'
      end

      @name = name.to_sym
      @value = value
      params = {ttl: domain.ttl_val}.merge(params)

      params.each do |key, value|
        self.send "#{key}", value if self.respond_to? key
      end

      super domain, host, params
      instance_eval &block  if block_given?
    end

    def type
      self.name
    end

    def value
      content = if @value.to_s.include?(' ')
        '"' + @value.to_s + '"'
      else
        @value
      end

      if @priority_val == 0
        content
      else
        "#{@priority_val} #{content}"
      end
    end

    def ttl v
      @ttl_val = v
    end
  end
{'fraction_non_alphanumeric': 0.0916506717850288, 'fraction_numerical': 0.00527831094049904, 'mean_word_length': 1.5709001233045623, 'pattern_counts': {'":': 0, '<': 5, '<?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': '5282518', 'n_tokens_mistral': 685, 'n_tokens_neox': 653, 'n_words': 198}