<commit_before>module VestalVersions
  # The ActiveRecord model representing versions.
  class Version < ActiveRecord::Base
    include Comparable

    # Associate polymorphically with the parent record.
    belongs_to :versioned, :polymorphic => true

    # Order versions by number, ascending by default.
    default_scope :order => "#{table_name}.number ASC"

    # ActiveRecord::Base#changes is an existing method, so before serializing the +changes+ column,
    # the existing +changes+ method is undefined. The overridden +changes+ method pertained to 
    # dirty attributes, but will not affect the partial updates functionality as that's based on
    # an underlying +changed_attributes+ method, not +changes+ itself.
    undef_method :changes
    serialize :changes, Hash

    # In conjunction with the included Comparable module, allows comparison of version records
    # based on their corresponding version numbers.
    def <=>(other)
      number <=> other.number
    end

    # Returns whether the version has a version number of 1. Useful when deciding whether to ignore<commit_msg>Changed the way that version records are compared to avoid false equality evaluations for versions belonging to separate versioned parents.<commit_after>module VestalVersions
  # The ActiveRecord model representing versions.
  class Version < ActiveRecord::Base
    include Comparable

    # Associate polymorphically with the parent record.
    belongs_to :versioned, :polymorphic => true

    # Order versions by number, ascending by default.
    default_scope :order => "#{table_name}.number ASC"

    # ActiveRecord::Base#changes is an existing method, so before serializing the +changes+ column,
    # the existing +changes+ method is undefined. The overridden +changes+ method pertained to 
    # dirty attributes, but will not affect the partial updates functionality as that's based on
    # an underlying +changed_attributes+ method, not +changes+ itself.
    undef_method :changes
    serialize :changes, Hash

    # In conjunction with the included Comparable module, allows comparison of version records
    # based on their corresponding version numbers, creation timestamps and IDs.
    def <=>(other)
      [number, created_at, id].map(&:to_i) <=> [other.number, other.created_at, other.id].map(&:to_i)
    end

    # Returns whether the version has a version number of 1. Useful when deciding whether to ignore
{'fraction_non_alphanumeric': 0.06597938144329897, 'fraction_numerical': 0.0008247422680412372, 'mean_word_length': 4.064718162839249, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, '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': '5692777', 'n_tokens_mistral': 612, 'n_tokens_neox': 575, 'n_words': 268}