class Mako::SubscriptionListParser
Attributes
list[R]
Public Class Methods
new(args)
click to toggle source
# File lib/mako/subscription_list_parser.rb, line 9 def initialize(args) @list = args.fetch(:list) end
Public Instance Methods
load_list()
click to toggle source
Load the subscription list file
@return [String]
# File lib/mako/subscription_list_parser.rb, line 30 def load_list load_resource(list) end
parse()
click to toggle source
Parses OPML, JSON, or plain text documents and returns an Array of feed urls.
@return [Array]
# File lib/mako/subscription_list_parser.rb, line 16 def parse case File.extname list when '.xml' || '.opml' Nokogiri::XML(load_list).xpath('//@xmlUrl').map(&:value) when '.json' JSON.parse(load_list) when '.txt' load_list.split("\n") end end