Revision: 2431
Updated Code
at February 14, 2007 14:28 by gtcaz
Updated Code
#!/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}" }
Revision: 2430
Updated Code
at February 14, 2007 14:27 by gtcaz
Updated Code
#!/usr/bin/ruby -w
require 'yaml'
str = "Hello, world!"
str.to_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}" }
Revision: 2429
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at February 14, 2007 14:22 by gtcaz
Initial Code
#!/usr/bin/ruby -w
require 'yaml'
str = "Hello, world!"
str.to_yaml
config = {"pass" => "mybigsecret123"}
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) }
p conf2['pass']
Initial URL
Initial Description
Initial Title
YAML Config File Example
Initial Tags
ruby
Initial Language
Ruby