Sha256: cd6e38977af2ed1103c3c9d340dcc9a37fbac8916f946da65af06b19aa8bab2e
Contents?: true
Size: 637 Bytes
Versions: 2
Compression:
Stored size: 637 Bytes
Contents
class Genre attr_accessor :name, :books extend Memorable::ClassMethods extend Findable::ClassMethods extend Sortable::ClassMethods include Memorable::InstanceMethods @@all = [] def initialize(attributes) @books = [] @name = attributes[:name] @books << attributes[:book] if attributes[:book] end def self.all @@all end def add_book(book) self.books << book unless self.books.include?(book) book.genre << self unless book.genre.include?(self) books end def authors @books.map { |book| book.author }.flatten.uniq end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
podcast-book-club-1.0.3 | lib/podcast_book_club/genre.rb |
podcast-book-club-1.0.2 | lib/podcast_book_club/genre.rb |