Method: Onoma::Nomenclature#best_match

Defined in:
lib/onoma/nomenclature.rb

#best_match(property_name, searched_item) ⇒ Object

Returns the best match on nomenclature properties



509
510
511
512
513
514
515
516
517
518
519
520
# File 'lib/onoma/nomenclature.rb', line 509

def best_match(property_name, searched_item)
  items = []
  begin
    list.select do |item|
      items << item if item.property(property_name) == searched_item.name
    end
    break if items.any?

    searched_item = searched_item.parent
  end while searched_item
  items
end