mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Warn if classifier instance is out of date
This commit is contained in:
@@ -29,6 +29,19 @@ module Linguist
|
||||
@languages = Hash.new(0)
|
||||
end
|
||||
|
||||
# Public: Compare Classifier objects.
|
||||
#
|
||||
# other - Classifier object to compare to.
|
||||
#
|
||||
# Returns Boolean.
|
||||
def eql?(other)
|
||||
# Lazy fast check counts only
|
||||
other.is_a?(self.class) &&
|
||||
@tokens_total == other.instance_variable_get(:@tokens_total) &&
|
||||
@languages_total == other.instance_variable_get(:@languages_total)
|
||||
end
|
||||
alias_method :==, :eql?
|
||||
|
||||
# Public: Train classifier that data is a certain language.
|
||||
#
|
||||
# language - Language of data
|
||||
|
||||
Reference in New Issue
Block a user