Created
November 23, 2018 09:27
-
-
Save nalabjp/2825c65fb28602e5f07322e334380e36 to your computer and use it in GitHub Desktop.
String Interpolation in YAML
This file contains 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
require 'yaml' | |
ENV.update('foo' => 'FOO') | |
ENV.update('bar' => 'BAR') | |
ENV.update('baz' => 'BAZ') | |
p YAML.load(<<EOS) | |
--- | |
foo: !ruby/string #{ENV['foo']} | |
bar: !str #{ENV['bar']} | |
baz: ! #{ENV['baz']} | |
EOS | |
# => {"foo"=>"FOO", "bar"=>"BAR", "baz"=>"BAZ"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment