class ChildrensBooks::Book

Attributes

age[RW]
author[RW]
description[RW]
title[RW]
url[RW]
year[RW]

Public Class Methods

all() click to toggle source
# File lib/childrens_books/book.rb, line 16
def self.all
    @@all
end
bigkidbooks() click to toggle source
# File lib/childrens_books/book.rb, line 32
def self.bigkidbooks
    self.all.select do |book|
        book if (8..9).to_a.include?(book.age.to_i) 
    end
end
littlekidbooks() click to toggle source
# File lib/childrens_books/book.rb, line 26
def self.littlekidbooks
    self.all.select do |book|
        book if (5..7).to_a.include?(book.age.to_i) 
    end
end
new(title, author, description, age, year, url) click to toggle source
# File lib/childrens_books/book.rb, line 6
def initialize(title, author, description, age, year, url)
    @title = title
    @author = author
    @description = description
    @age = age
    @year = year
    @url = url
    @@all << self
end
preschoolbooks() click to toggle source
# File lib/childrens_books/book.rb, line 20
def self.preschoolbooks
    self.all.select do |book|
        book if (2..4).to_a.include?(book.age.to_i)
    end
end
tweenbooks() click to toggle source
# File lib/childrens_books/book.rb, line 38
def self.tweenbooks
    self.all.select do |book|
        book if (10..12).to_a.include?(book.age.to_i) 
    end
end