Class: BookwormBestSellers::Book

Inherits:
Object
  • Object
show all
Defined in:
lib/bookworm_best_sellers/book.rb

Constant Summary collapse

@@current_book_list =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Book

Returns a new instance of Book.



5
6
7
8
9
10
11
# File 'lib/bookworm_best_sellers/book.rb', line 5

def initialize(attributes = {})
  @title = attributes[:title]
  @author = attributes[:author]
  @description = attributes[:description]
  @url = attributes[:url]
  @@current_book_list << self
end

Instance Attribute Details

#authorObject

Returns the value of attribute author.



2
3
4
# File 'lib/bookworm_best_sellers/book.rb', line 2

def author
  @author
end

#descriptionObject

Returns the value of attribute description.



2
3
4
# File 'lib/bookworm_best_sellers/book.rb', line 2

def description
  @description
end

#titleObject

Returns the value of attribute title.



2
3
4
# File 'lib/bookworm_best_sellers/book.rb', line 2

def title
  @title
end

#urlObject

Returns the value of attribute url.



2
3
4
# File 'lib/bookworm_best_sellers/book.rb', line 2

def url
  @url
end

Class Method Details

.allObject



13
14
15
# File 'lib/bookworm_best_sellers/book.rb', line 13

def self.all
  @@current_book_list
end