Module: Bparity::SpecBundle::Loader

Defined in:
lib/bparity/spec_bundle.rb

Class Method Summary collapse

Class Method Details

.load(path, verify_checksum: true) ⇒ Object



198
199
200
201
202
203
204
205
# File 'lib/bparity/spec_bundle.rb', line 198

def load(path, verify_checksum: true)
  data = YAML.safe_load_file(path, permitted_classes: [Date, Time], aliases: false)
  Validator.validate!(data, verify_checksum:)
rescue Errno::ENOENT
  raise InvalidBundleError, "Cannot read #{path}. Run `bparity synthesize` or check the path."
rescue Psych::Exception => e
  raise InvalidBundleError, "Cannot read #{path}: #{e.message}. Fix the YAML or regenerate the bundle."
end