Class: Category

Inherits:
Object
  • Object
show all
Defined in:
lib/nyt_bestsellers_cli_gem/category.rb

Constant Summary collapse

@@all =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Category

Returns a new instance of Category.



7
8
9
10
11
# File 'lib/nyt_bestsellers_cli_gem/category.rb', line 7

def initialize(name)
  @name = name
  @books = []
  @@all << self 
end

Instance Attribute Details

#booksObject

Returns the value of attribute books.



3
4
5
# File 'lib/nyt_bestsellers_cli_gem/category.rb', line 3

def books
  @books
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/nyt_bestsellers_cli_gem/category.rb', line 3

def name
  @name
end

Class Method Details

.allObject



13
14
15
# File 'lib/nyt_bestsellers_cli_gem/category.rb', line 13

def self.all
  @@all
end