Published in: Ruby
#A. Import the YAML Library require 'yaml' #B. Create an array names = %w[chris sandy josie billy suzie] #Example 1 : Converting an array into YAML using: to_yaml yaml_example1 = names.to_yaml puts yaml_example1 #Example 2: Converting an array into YAML using: dump() yaml_example2 = YAML::dump(names) puts yaml_example2 #Example 3: Loading YAML back into an array using: load() array_example = YAML::load(yamloutput2) puts array_example
You need to login to post a comment.
