guardian_manifest.rb
##
# Check YAML data for required and valid values.
#
# @param [Hash] yaml_data parsed YAML data
# @raise [RuntimeError] if any errors are encountered
Check YAML data for required and valid values.
Check YAML data for required and valid values .
def validate_yaml(yaml_data)
  missing = REQUIRED_VALUES.select { |head| yaml_data[head].to_s.strip.empty? }
  raise "Required YAML values missing: #{missing.join(', ')}" unless missing.empty?
  return if yaml_data['verification_sample_size'].to_s.strip.empty?
  unless valid_sample_size?(yaml_data['verification_sample_size'])
    raise "Invalid verification_sample_size: '#{yaml_data['verification_sample_size']}' (expected 'ALL' or a proportion, like '1/10')"
  end
  if yaml_data['verification_destination'].to_s.strip.empty?
    raise "'verification_destination' must be provided if 'verification_sample_size' is set"
  end
end
def validate_yaml ( yaml_data ) missing = REQUIRED_VALUES . select { | head | yaml_data [ head ] . to_s . strip . empty? } raise "Required YAML values missing: #{missing.join(', ')}" unless missing . empty? return if yaml_data [ 'verification_sample_size' ] . to_s . strip . empty? unless valid_sample_size? ( yaml_data [ 'verification_sample_size' ] ) raise "Invalid verification_sample_size: '#{yaml_data['verification_sample_size']}' (expected 'ALL' or a proportion, like '1/10')" end if yaml_data [ 'verification_destination' ] . to_s . strip . empty? raise "'verification_destination' must be provided if 'verification_sample_size' is set" end end
Check YAML data for required and valid values.
Check YAML data for required and valid values .
# if no `verification_sample_size` is given, we're done
[RuntimeError] if any errors are encountered
[ RuntimeError ] if any errors are encountered
yaml_data
<not_specific>
<not_specific>
yaml_data parsed YAML data
yaml_data parsed YAML data