Class: Nytimesbooks::Book
- Inherits:
-
Object
- Object
- Nytimesbooks::Book
- Defined in:
- lib/nytimesbooks/books.rb
Instance Attribute Summary collapse
-
#author ⇒ Object
Returns the value of attribute author.
-
#bookdescription ⇒ Object
Returns the value of attribute bookdescription.
-
#name ⇒ Object
Returns the value of attribute name.
Class Method Summary collapse
Instance Attribute Details
#author ⇒ Object
Returns the value of attribute author.
2 3 4 |
# File 'lib/nytimesbooks/books.rb', line 2 def end |
#bookdescription ⇒ Object
Returns the value of attribute bookdescription.
2 3 4 |
# File 'lib/nytimesbooks/books.rb', line 2 def bookdescription @bookdescription end |
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/nytimesbooks/books.rb', line 2 def name @name end |
Class Method Details
.new_book(doc) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/nytimesbooks/books.rb', line 5 def self.new_book(doc) new_array = [] doc.css("div.book-body").each do |book| new_book = self.new new_book.name = book.css("css-5pe77f").text new_book. = book.css("css-hjukut").text new_book.bookdescription = book.css("css-14lubdp").text new_array << new_book end new_array end |