Skip to content

Instantly share code, notes, and snippets.

@rajeevkannav
Last active December 11, 2015 13:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rajeevkannav/4605267 to your computer and use it in GitHub Desktop.
Save rajeevkannav/4605267 to your computer and use it in GitHub Desktop.
To Covert Given Data Strcutre to YML
###################################################################################################
############### To Covert Given Data Strcutre to YML ####################
###################################################################################################
# Example Data Strcutre USED
# {'root' => {'recog' => [{:day => 1, :month => 2},{:day => 1, :month => 2},{:day => 1, :month => 2}],'delivery' => [{:day => 1, :month => 2},{:day => 1, :month => 2},{:day => 1, :month => 2}],'third' => [{:day => 1, :month => 2},{:day => 1, :month => 2},{:day => 1, :month => 2}]}}
require 'yaml'
puts "Enter your Specified Data Strcutre withOut Quotes"
required_ds = gets.chomp
File.open('root.yml','w') do|file|
file.puts eval(required_ds).to_yaml
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment