Sample YAML Loader:
Assume your yaml file 'email_credential.yml' exists in same directory and in the format below:
email:
smtp_server: smtp.gmail.com
smtp_port: 587
Here is the simple snippet to load YAML and collect data:
begin
yml = YAML.load_file("email_credentials.yml")
email = yml['email']['smtp_server']
eport = yml['email']['smtp_port']
rescue Exception => e
puts "Email credential YAML loading issue \n" + e.to_s
end
No comments:
Post a Comment