Skip to content

Instantly share code, notes, and snippets.

@thesunwave
Created February 19, 2016 09:08
Show Gist options
  • Save thesunwave/2bd74bc962d01300d39e to your computer and use it in GitHub Desktop.
Save thesunwave/2bd74bc962d01300d39e to your computer and use it in GitHub Desktop.
[4] pry(main)> var1 = File.open(Rails.root.join("config/redis.yml"))
=> #<File:/Users/thesunwave/Documents/work/ural1/config/redis.yml>
[5] pry(main)> var2 = File.read(Rails.root.join("config/redis.yml"))
=> "default: &default\n host: localhost\n port: 6379\ndevelopment:\n <<: *default\ntest:\n <<: *default\nproduction:\n host: \#{ ENV[\"REDIS_URL\"] }\n"
[6] pry(main)> var3 = IO.read(Rails.root.join("config/redis.yml"))
=> "default: &default\n host: localhost\n port: 6379\ndevelopment:\n <<: *default\ntest:\n <<: *default\nproduction:\n host: \#{ ENV[\"REDIS_URL\"] }\n"
[7] pry(main)> YAML.load var1
=> {"default"=>{"host"=>"localhost", "port"=>6379},
"development"=>{"host"=>"localhost", "port"=>6379},
"test"=>{"host"=>"localhost", "port"=>6379},
"production"=>{"host"=>nil}}
[8] pry(main)> YAML.load var2
=> {"default"=>{"host"=>"localhost", "port"=>6379},
"development"=>{"host"=>"localhost", "port"=>6379},
"test"=>{"host"=>"localhost", "port"=>6379},
"production"=>{"host"=>nil}}
[9] pry(main)> YAML.load var3
=> {"default"=>{"host"=>"localhost", "port"=>6379},
"development"=>{"host"=>"localhost", "port"=>6379},
"test"=>{"host"=>"localhost", "port"=>6379},
"production"=>{"host"=>nil}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment