Class: KindleNotebook::Book
- Inherits:
-
Object
- Object
- KindleNotebook::Book
- Defined in:
- lib/kindle_notebook/book.rb
Instance Attribute Summary collapse
-
#asin ⇒ Object
readonly
Returns the value of attribute asin.
-
#author ⇒ Object
readonly
Returns the value of attribute author.
-
#highlights ⇒ Object
Returns the value of attribute highlights.
-
#highlights_count ⇒ Object
Returns the value of attribute highlights_count.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
- #fetch_highlights ⇒ Object
-
#initialize(book_attrs) ⇒ Book
constructor
A new instance of Book.
- #to_csv_file ⇒ Object
Constructor Details
#initialize(book_attrs) ⇒ Book
Returns a new instance of Book.
8 9 10 11 12 13 14 |
# File 'lib/kindle_notebook/book.rb', line 8 def initialize(book_attrs) @author = book_attrs[:author] @title = book_attrs[:title] @asin = book_attrs[:asin] @highlights_count = nil @highlights = [] end |
Instance Attribute Details
#asin ⇒ Object (readonly)
Returns the value of attribute asin.
5 6 7 |
# File 'lib/kindle_notebook/book.rb', line 5 def asin @asin end |
#author ⇒ Object (readonly)
Returns the value of attribute author.
5 6 7 |
# File 'lib/kindle_notebook/book.rb', line 5 def @author end |
#highlights ⇒ Object
Returns the value of attribute highlights.
6 7 8 |
# File 'lib/kindle_notebook/book.rb', line 6 def highlights @highlights end |
#highlights_count ⇒ Object
Returns the value of attribute highlights_count.
6 7 8 |
# File 'lib/kindle_notebook/book.rb', line 6 def highlights_count @highlights_count end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
5 6 7 |
# File 'lib/kindle_notebook/book.rb', line 5 def title @title end |
Instance Method Details
#fetch_highlights ⇒ Object
16 17 18 19 |
# File 'lib/kindle_notebook/book.rb', line 16 def fetch_highlights open_book unless session.current_url.include?(asin) Highlights.new(self).fetch end |
#to_csv_file ⇒ Object
21 22 23 24 |
# File 'lib/kindle_notebook/book.rb', line 21 def to_csv_file headers = highlights.first.attributes Helpers.to_csv_file(headers, highlights, "#{title} - #{}.csv") end |