Sha256: f43749476e5b366efda9ae06d7a8aae6d68b3c344c0aac1099efd03c5970fdca

Contents?: true

Size: 646 Bytes

Versions: 1

Compression:

Stored size: 646 Bytes

Contents

require_relative '../lib/scraper.rb'

class DayBooks::Book
  attr_accessor :title, :all_titles, :book_url
  @@all = []
  @@all_titles = []

  def initialize(title = nil, book_url = nil)
    @title = title
    @book_url = book_url
  end

  def self.all
    @@all
  end

  def self.all_titles
    @@all_titles
  end

  def save
    @@all << self
    @@all_titles << @title
  end

  def self.empty_all
    @@all.clear
    @@all_titles.clear
  end

  def self.downcase_all_titles
    @@all_titles.map {|title| title.downcase}
  end

  def self.create(title, book_url)
    new_book = self.new(title, book_url)
    new_book.save
    new_book
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
day_books-0.1.0 lib/book.rb