Class: Kindle::Exports::Markdown

Inherits:
Object
  • Object
show all
Defined in:
lib/kindle/exports/markdown.rb

Instance Method Summary collapse

Constructor Details

#initialize(books) ⇒ Markdown

Returns a new instance of Markdown.



4
5
6
7
8
9
10
11
12
# File 'lib/kindle/exports/markdown.rb', line 4

def initialize(books)
  @document = "## Kindle Highlights\n\n"
  books.each do |book|
    @document << "\n### #{book.title} by #{book.author}\n\n"
    book.highlights.each do |highlight|
      @document << "> #{highlight.highlight}\n\n"
    end
  end
end

Instance Method Details

#to_sObject



13
14
15
# File 'lib/kindle/exports/markdown.rb', line 13

def to_s
  @document
end