Class: Feed2Email::OPMLExporter

Inherits:
Object
  • Object
show all
Defined in:
lib/feed2email/opml_exporter.rb

Constant Summary collapse

MAX_REDIRECTS =
10

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uris) ⇒ OPMLExporter

Returns a new instance of OPMLExporter.



21
22
23
# File 'lib/feed2email/opml_exporter.rb', line 21

def initialize(uris)
  @uris = uris
end

Class Method Details

.export(path) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/feed2email/opml_exporter.rb', line 9

def self.export(path)
  require 'feed2email/feed'

  open(path, 'w') do |f|
    uris = Feed.by_smallest_id.select_map(:uri)

    if new(uris).export(f) > 0
      uris.size
    end
  end
end

Instance Method Details

#export(io) ⇒ Object



25
26
27
# File 'lib/feed2email/opml_exporter.rb', line 25

def export(io)
  io.write(xml)
end