Module: AttrSimilar::ClassMethods
- Defined in:
- lib/attr_similar.rb
Instance Method Summary collapse
Instance Method Details
#attr_similar(threshold_or_thresholds, *attributes) ⇒ Object
8 9 10 11 12 13 14 15 |
# 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 |