<commit_before>module RASN1
  module Types

    # ASN.1 ANY: accepts any types
    #
    # If `any#value` is `nil`, `any` will be encoded as a {Null} object.
    # @author <NAME>
    class Any < Base

      # @return [String] DER-formated string
      def to_der
        case @value
        when Base, Model
          @value.to_der
        when nil
          Null.new(@name).to_der
        else
          @value.to_s
        end
      end

      # Parse a DER string. This method updates object: {#value} will be a DER
      # string.
      # @param [String] der DER string
      # @param [Boolean] ber if +true+, accept BER encoding
      # @return [Integer] total number of parsed bytes
      def parse!(der, ber: false)
        total_length,  = get_data(der, ber)
        @value = der[0, total_length]
        total_length
      end

      def inspect(level=0)
        str = ''
        str << '  ' * level if level > 0
        if @value.nil?
          str << "#{name} (ANY) NULL"
        elsif @value.is_a?(OctetString)
          str << "#{name} (ANY) #{@value.type}: #{value.value.inspect}"
        else
          str << "#{name} (ANY) #{@value.type}: #{value.value}"
        end
      end
    end
  end
end<commit_msg>Fix Types::Any#inspect<commit_after>module RASN1
  module Types

    # ASN.1 ANY: accepts any types
    #
    # If `any#value` is `nil`, `any` will be encoded as a {Null} object.
    # @author <NAME>
    class Any < Base

      # @return [String] DER-formated string
      def to_der
        case @value
        when Base, Model
          @value.to_der
        when nil
          Null.new(@name).to_der
        else
          @value.to_s
        end
      end

      # Parse a DER string. This method updates object: {#value} will be a DER
      # string.
      # @param [String] der DER string
      # @param [Boolean] ber if +true+, accept BER encoding
      # @return [Integer] total number of parsed bytes
      def parse!(der, ber: false)
        total_length,  = get_data(der, ber)
        @value = der[0, total_length]
        total_length
      end

      def inspect(level=0)
        str = ''
        str << '  ' * level if level > 0
        if @value.nil?
          str << "#{name} (ANY) NULL"
        elsif @value.is_a?(OctetString)
          str << "#{name} (ANY) #{@value.type}: #{value.value.inspect}"
        elsif @value.class < Base
          str << "#{name} (ANY) #{@value.type}: #{value.value}"
        else
          str << "#{name} (ANY) #{value.to_s.inspect}"
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.12264150943396226, 'fraction_numerical': 0.003930817610062893, 'mean_word_length': 1.7967032967032968, 'pattern_counts': {'":': 0, '<': 26, '<?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': '7423781', 'n_tokens_mistral': 826, 'n_tokens_neox': 811, 'n_words': 253}