Method: Eir::Request#validate_yaml

Defined in:
lib/eir/request.rb

#validate_yaml(path_to_yaml) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/eir/request.rb', line 23

def validate_yaml(path_to_yaml)
  invalid_yaml_error = 'YAML structure incorrect. Please refer to the README.'
  yaml               = YAML.load_file path_to_yaml
  fail(invalid_yaml_error) unless yaml.is_a? Array
  yaml.each { |hash| fail(invalid_yaml_error) unless hash.is_a? Hash }
  yaml
end