Class: WinewooCore::Services::Finders::Comments::WineCommentsFinder

Inherits:
CommentsFinder
  • Object
show all
Defined in:
lib/winewoo_core/services/finders/comments/wine_comments_finder.rb

Instance Method Summary collapse

Constructor Details

#initialize(wine_id, filters) ⇒ WineCommentsFinder

Returns a new instance of WineCommentsFinder.



4
5
6
7
# File 'lib/winewoo_core/services/finders/comments/wine_comments_finder.rb', line 4

def initialize(wine_id, filters)
  super(filters)
  @wine_id = wine_id
end

Instance Method Details

#findObject



10
11
12
13
14
# File 'lib/winewoo_core/services/finders/comments/wine_comments_finder.rb', line 10

def find
  return unless @wine_id
  wine = Wine.find(@wine_id)
  return wine.vintages.map(&:user_comments).flatten if wine
end