<commit_before>module DropboxApiV2::Metadata
  class Factory
    def self.build(data, discriminator)
      self.new(data, discriminator).build
    end

    def initialize(data, discriminator)
      @data = data
      @discriminator = discriminator
    end

    def build
      datatype_class.new @data
    end

    private

    # NOTE: Further datatypes are pending, next one could be :folder
    def datatype_class
      {
        :file => File,
        :folder => Folder
      }[datatype]
    end

    def datatype
      case @discriminator
      when :file_or_folder
        @data[".tag"].to_sym
      when :file, :folder
        @discriminator
      else
        raise ArgumentError, "Unknown datatype `#{@datatype}`"
      end
    end
  end
end
<commit_msg>Removes deprecated comment.<commit_after>module DropboxApiV2::Metadata
  class Factory
    def self.build(data, discriminator)
      self.new(data, discriminator).build
    end

    def initialize(data, discriminator)
      @data = data
      @discriminator = discriminator
    end

    def build
      datatype_class.new @data
    end

    private

    def datatype_class
      {
        :file => File,
        :folder => Folder
      }[datatype]
    end

    def datatype
      case @discriminator
      when :file_or_folder
        @data[".tag"].to_sym
      when :file, :folder
        @discriminator
      else
        raise ArgumentError, "Unknown datatype `#{@datatype}`"
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.07964601769911504, 'fraction_numerical': 0.0013614703880190605, 'mean_word_length': 2.161290322580645, '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': '6068194', 'n_tokens_mistral': 447, 'n_tokens_neox': 438, 'n_words': 118}