Method: Threatinator::FeedBuilder.from_file

Defined in:
lib/threatinator/feed_builder.rb

.from_file(filename) ⇒ Object

Loads the provided file, and generates a builder from it.

Parameters:

  • filename (String)

    The name of the file to read the feed from

Raises:

  • (FeedFileNotFoundError)

    if the file is not found



122
123
124
125
126
127
128
129
# File 'lib/threatinator/feed_builder.rb', line 122

def self.from_file(filename)
  begin 
    filedata = File.read(filename)
  rescue Errno::ENOENT
    raise Threatinator::Exceptions::FeedFileNotFoundError.new(filename)
  end
  from_string(filedata, filename, 0)
end