Method: Concept#try_adding_neighbor
- Defined in:
- lib/asker/data/concept.rb
#try_adding_neighbor(other) ⇒ Object
62 63 64 65 66 67 68 69 70 |
# File 'lib/asker/data/concept.rb', line 62 def try_adding_neighbor(other) p = calculate_nearness_to_concept(other) return if p.zero? @data[:neighbors] << {concept: other, value: p} # Sort neighbors list @data[:neighbors].sort! { |a, b| a[:value] <=> b[:value] } @data[:neighbors].reverse! end |