class Episode

Attributes

books[RW]
date[RW]
description[RW]
title[RW]

Public Class Methods

all() click to toggle source
# File lib/podcast_book_club/episode.rb, line 21
def self.all
  @@all
end
find_by_date(first_date, last_date) click to toggle source
# File lib/podcast_book_club/episode.rb, line 36
def self.find_by_date(first_date, last_date)
  self.all.select { |ep| ep.date >= first_date && ep.date <= last_date }
end
find_by_keyword(keyword) click to toggle source
# File lib/podcast_book_club/episode.rb, line 31
def self.find_by_keyword(keyword)
  self.all.select { |ep| ep.title.downcase.include?(keyword) }
end
new(attributes) click to toggle source
# File lib/podcast_book_club/episode.rb, line 12
def initialize(attributes)
  @books = []

  attributes.each do |k, v|
    self.send("#{k}=", v)
  end

end

Public Instance Methods

add_book(book) click to toggle source
# File lib/podcast_book_club/episode.rb, line 25
def add_book(book)
  self.books << book unless self.books.include?(book)
  book.episode << self unless book.episode.include?(self)
  books
end