Class: Markdo::RssCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/markdo/rss_command.rb

Defined Under Namespace

Classes: Item

Instance Method Summary collapse

Methods inherited from Command

#initialize

Constructor Details

This class inherits a constructor from Markdo::Command

Instance Method Details

#runObject



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/markdo/rss_command.rb', line 6

def run
  items = Dir.
    glob(markdown_glob).
    map { |path| File.readlines(path, encoding: 'UTF-8') }.
    flatten.
    grep(%r(https?://)).
    map { |line| Item.new(title: clean(line), links: URI.extract(line)) }

  xml = template(items)

  @stdout.puts(xml)
end