<commit_before>module Rubinius
  module Metrics
    def self.data
      @data ||= Data.new
    end

    class Data
      def keys
        Map.keys
      end

      def values
        Values.to_a
      end

      def [](key)
        Values[Map[key]]
      end

      def to_hash
        Map.map { |k, i| [k, Values[i]] }.to_h
      end
    end
  end
end<commit_msg>Reuse Hash for Rubinius::Metrics values.<commit_after>module Rubinius
  module Metrics
    def self.data
      @data ||= Data.new
    end

    class Data
      MetricsHash = Hash.new

      def keys
        Map.keys
      end

      def values
        Values.to_a
      end

      def [](key)
        Values[Map[key]]
      end

      def to_hash
        Map.map { |k, i| MetricsHash[k] = Values[i] }
        MetricsHash
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.0812807881773399, 'fraction_numerical': 0.0, 'mean_word_length': 1.4636363636363636, 'pattern_counts': {'":': 0, '<': 3, '<?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': '7451278', 'n_tokens_mistral': 285, 'n_tokens_neox': 267, 'n_words': 75}