diff options
Diffstat (limited to 'src/main/scala/reading/models/Book.scala')
-rw-r--r-- | src/main/scala/reading/models/Book.scala | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main/scala/reading/models/Book.scala b/src/main/scala/reading/models/Book.scala index 7d72f23..6f4d8dd 100644 --- a/src/main/scala/reading/models/Book.scala +++ b/src/main/scala/reading/models/Book.scala @@ -16,6 +16,9 @@ case class Book( } object Book { - def filter(books: Seq[Book], filters: Seq[Filter]): Seq[Book] = - books.filter(b => filters.forall(_.filter(b))) + def filter(books: Seq[Book], search: String = ""): Seq[Book] = + books.filter { book => + (Search(book.title, search) + || Search(book.author, search)) + } } |