class Author

Attributes

books[RW]
name[RW]

Public Class Methods

all() click to toggle source
# File lib/podcast_book_club/author.rb, line 19
def self.all
  @@all
end
new(attributes) click to toggle source
# File lib/podcast_book_club/author.rb, line 11
def initialize(attributes)
    @books = []

    @name = attributes[:name]
    self.add_book(attributes[:book])

end

Public Instance Methods

add_book(book) click to toggle source
# File lib/podcast_book_club/author.rb, line 23
def add_book(book)
    @books << book unless @books.include?(book)
end
genres() click to toggle source
# File lib/podcast_book_club/author.rb, line 27
def genres
    @books.map { |book| book.genre }.flatten.uniq
end