Sha256: bd4a96da47acc9bb37455b7bfcf7442f5466a839c5727d99bf63b34521f534b3

Contents?: true

Size: 547 Bytes

Versions: 2

Compression:

Stored size: 547 Bytes

Contents

class Author
    attr_accessor :name, :books

    extend Memorable::ClassMethods
    extend Findable::ClassMethods
    extend Sortable::ClassMethods
    include Memorable::InstanceMethods

    @@all = []

    def initialize(attributes)
        @books = []

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

    end

    def self.all
      @@all
    end

    def add_book(book)
        @books << book unless @books.include?(book)
    end

    def genres
        @books.map { |book| book.genre }.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/author.rb
podcast-book-club-1.0.2 lib/podcast_book_club/author.rb