Class: Rutt::Share::Kindle

Inherits:
Object
  • Object
show all
Defined in:
lib/rutt/share/kindle.rb

Instance Method Summary collapse

Constructor Details

#initialize(feed) ⇒ Kindle

Returns a new instance of Kindle.



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/rutt/share/kindle.rb', line 4

def initialize(feed)

  items = Rutt::DB::Item.unread(feed)

  # TODO: Should be name of feed
  title = "rutt feed"

  puts "<html><head><title>#{title}</title></head><body>"
  puts "<h1>rutt feed</h1>"

  items.each do |item|
    puts "<mbp:pagebreak/>"
    puts "<h2>#{item['title']}</h2>"
    puts ::Readability::Document.new(open(item['url']).read).content
  end
  puts "</body></html>"

  items.each do |item|
    Rutt::DB::Item.mark_as_read(item)
  end
end