Class: Bestsellers::Books
- Inherits:
-
Object
- Object
- Bestsellers::Books
- Defined in:
- lib/bestsellers/books.rb
Constant Summary collapse
- @@books =
[]
Instance Attribute Summary collapse
-
#author ⇒ Object
Returns the value of attribute author.
-
#price ⇒ Object
Returns the value of attribute price.
-
#title ⇒ Object
Returns the value of attribute title.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(title, author, price, url) ⇒ Books
constructor
A new instance of Books.
Constructor Details
#initialize(title, author, price, url) ⇒ Books
Returns a new instance of Books.
5 6 7 8 9 10 11 |
# File 'lib/bestsellers/books.rb', line 5 def initialize(title, ,price, url) @title = title @author = @price = price @url = url @@books << self end |
Instance Attribute Details
#author ⇒ Object
Returns the value of attribute author.
2 3 4 |
# File 'lib/bestsellers/books.rb', line 2 def @author end |
#price ⇒ Object
Returns the value of attribute price.
2 3 4 |
# File 'lib/bestsellers/books.rb', line 2 def price @price end |
#title ⇒ Object
Returns the value of attribute title.
2 3 4 |
# File 'lib/bestsellers/books.rb', line 2 def title @title end |
#url ⇒ Object
Returns the value of attribute url.
2 3 4 |
# File 'lib/bestsellers/books.rb', line 2 def url @url end |
Class Method Details
.all ⇒ Object
13 14 15 |
# File 'lib/bestsellers/books.rb', line 13 def self.all @@books end |