Class: WinewooCore::Repositories::Mongo::CriterionsMongoRepo::AppelationsFinder

Inherits:
Finder
  • Object
show all
Defined in:
lib/winewoo_core/repositories/mongo/criterions_mongo_repo.rb

Instance Method Summary collapse

Methods inherited from Finder

#initialize

Constructor Details

This class inherits a constructor from WinewooCore::Repositories::Mongo::CriterionsMongoRepo::Finder

Instance Method Details

#findObject



72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/winewoo_core/repositories/mongo/criterions_mongo_repo.rb', line 72

def find
  WinewooCore::Repositories::Mongo::Queries::InterproQuery.new.all.map do |interpro|
    if interpro.wine_data_element &&
        interpro.wine_data_element.appelations.any? &&
        any_wines?(interpro)
      {
        interpro: interpro.name,
        interpro_id: interpro.id,
        appelations: interpro.wine_data_element.appelations
      }
    end
  end
end

#map(found_criterions) ⇒ Object



87
88
89
# File 'lib/winewoo_core/repositories/mongo/criterions_mongo_repo.rb', line 87

def map(found_criterions)
  return found_criterions.compact
end