Class: Relaton::Iana::DataFetcher

Inherits:
Core::DataFetcher
  • Object
show all
Defined in:
lib/relaton/iana/data_fetcher.rb

Instance Method Summary collapse

Instance Method Details

#fetch(_source = nil) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/relaton/iana/data_fetcher.rb', line 15

def fetch(_source = nil)
  Dir["iana-registries/**/*.xml"].each do |file|
    content = File.read file, encoding: "UTF-8"
    parse(content) if content.include? "<registry"
  rescue StandardError => e
    Util.error "Error: #{e.message}. File: #{file}"
  end
  index.save
  report_errors
end

#log_error(msg) ⇒ Object

Parse documents



11
12
13
# File 'lib/relaton/iana/data_fetcher.rb', line 11

def log_error(msg)
  Util.error msg
end