class Threatinator::FeedRegistry
Public Class Methods
build(config)
click to toggle source
Builds a new FeedRegistry
based on the provided config @param [Threatinator::Config::FeedSearch] config The configuration
# File lib/threatinator/feed_registry.rb, line 36 def self.build(config) ret = self.new config.search_path.each do |path| pattern = File.join(path, "**", "*.feed") Dir.glob(pattern).each do |filename| ret.register_from_file(filename) end end ret end
Public Instance Methods
each() { |feed| ... }
click to toggle source
Calls superclass method
# File lib/threatinator/feed_registry.rb, line 20 def each return enum_for(:each) unless block_given? super do |key, feed| yield(feed) end end
get(provider, name)
click to toggle source
@param [String] provider @param [String] name @return [Threatinator::Feed]
Calls superclass method
# File lib/threatinator/feed_registry.rb, line 16 def get(provider, name) super([provider, name]) end
register(feed)
click to toggle source
@param [Threatinator::Feed] feed The feed to register @raise [Threatinator::Exceptions::AlreadyRegisteredError] if a feed
with the same name and provider is already registered.
Calls superclass method
# File lib/threatinator/feed_registry.rb, line 9 def register(feed) super([feed.provider, feed.name], feed) end
register_from_file(filename)
click to toggle source
# File lib/threatinator/feed_registry.rb, line 27 def register_from_file(filename) builder = Threatinator::FeedBuilder.from_file(filename) feed = builder.build register(feed) feed end