Class: Waivers::JSONFileReader

Inherits:
Object
  • Object
show all
Defined in:
lib/inspec/utils/waivers/json_file_reader.rb

Class Method Summary collapse

Class Method Details

.fetch_data(path) ⇒ Object



9
10
11
12
13
# File 'lib/inspec/utils/waivers/json_file_reader.rb', line 9

def self.fetch_data(path)
  JSON.parse(File.read(path))
rescue JSON::ParserError => e
  raise "Error reading InSpec waivers in JSON: #{e}"
end

.resolve(path) ⇒ Object



3
4
5
6
7
# File 'lib/inspec/utils/waivers/json_file_reader.rb', line 3

def self.resolve(path)
  return nil unless File.file?(path)

  fetch_data(path)
end