/ Published in: Ruby

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#!/usr/bin/ruby -w require 'yaml' config = {"pass" => "mybigsecret123", "dir"=>"/cygdrive/c/tmp/", "user"=>"gtcaz", "url"=>"http://snipplr.com"} p config.to_yaml open('/cygdrive/c/tmp/config.yml', 'w') {|f| YAML.dump(config, f)} open('/cygdrive/c/tmp/config.yml') {|f| puts f.read} conf2 = open('/cygdrive/c/tmp/config.yml') {|f| YAML.load(f) } conf2.each{ |k, v| puts "#{k} => #{v}" }
Comments
