<commit_before>module VestalVersions
  module Reversion
    def version
      @version ||= last_version
    end

    def revert_to(value)
      to_number = versions.number_at(value)
      changes = changes_between(version, to_number)
      return version if changes.empty?

      changes.each do |attribute, change|
        write_attribute(attribute, change.last)
      end
<commit_msg>Simplified the revert_to method to remove duplication with changes_between.<commit_after>module VestalVersions
  module Reversion
    def version
      @version ||= last_version
    end

    def revert_to(value)
      to_number = versions.number_at(value)

      changes_between(version, to_number).each do |attribute, change|
        write_attribute(attribute, change.last)
      end

{'fraction_non_alphanumeric': 0.06744487678339818, 'fraction_numerical': 0.0, 'mean_word_length': 3.337078651685393, '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': '4870127', 'n_tokens_mistral': 224, 'n_tokens_neox': 215, 'n_words': 56}