Yaml actually comes as part of the ruby core, therefore there is no ruby gem for it.
AnnouncementI have released my new course on Udemy, Kubernetes By Example. Sign up now to get free lifetime access!
Lets say you have the following yaml file:
$ cat /etc/credentials.yaml --- :foreman: :username: 'codingbee' :password: 'liverpool'
now you want use these content, then you do:
cat yamldemo.rb require 'yaml' credentials = YAML.load_file("/etc/credentials.yaml") @username = credentials[:foreman][:username] @password = credentials[:foreman][:password] puts @username puts @password
Which leads to:
$ ruby yamldemo.rb codingbee liverpool