module AttrSimilar::ClassMethods
Public Instance Methods
attr_similar(threshold_or_thresholds, *attributes)
click to toggle source
# File lib/attr_similar.rb, line 8 def attr_similar(threshold_or_thresholds, *attributes) if threshold_or_thresholds.is_a?(Array) && threshold_or_thresholds.size != attributes.size raise 'Threshold count must equal number of attributes' end define_method :find_first_similar do |scope| AttrSimilar::SimilarityMatching.find_first_similar(scope, self, threshold_or_thresholds, attributes) end end