Skip to content

Instantly share code, notes, and snippets.

@btoone
Created March 28, 2012 20:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save btoone/2230355 to your computer and use it in GitHub Desktop.
Save btoone/2230355 to your computer and use it in GitHub Desktop.
Load yaml from a string
require 'yaml'
y = <<-YAML
:one:
:two:
:development:
:adapter: mysql2
:host: 127.0.0.1
:database: app_development
:username: root
:password: ''
:port: 3307
YAML
database = YAML.load(y)
# database = YAML.load_file('file.yml')
puts database
puts database[:development]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment