Last active
December 11, 2015 13:08
-
-
Save rajeevkannav/4605267 to your computer and use it in GitHub Desktop.
To Covert Given Data Strcutre to YML
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################################################### | |
############### 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