class Psych::TreeBuilder
NOTE: To support environment variable substitution in YAML file.
Syntax of embedding environment variable is below; env_var_specifier : '$' env_var_name | '$' '{' env_var_name '}' env_var_name : [A-Za-z_][0-9A-Za-z_]* Examples of environment variable as any scalar value; string_item: $VAR boolean_item: $VAR decimal_item: $VAR Examples of embedding environment variable in string; string_item: "foo${VAR}baz"
Public Instance Methods
scalar(value, anchor, tag, plain, quoted, style)
click to toggle source
# File lib/adlint/prelude.rb, line 335 def scalar(value, anchor, tag, plain, quoted, style) _orig_scalar(substitute_environment_variables(value), anchor, tag, plain, quoted, style) end
Also aliased as: _orig_scalar
Private Instance Methods
substitute_environment_variables(string)
click to toggle source
# File lib/adlint/prelude.rb, line 341 def substitute_environment_variables(string) string.gsub(/(?<!\\)\${?([a-z_][0-9a-z_]*)}?/i) do (value = ENV[$1]) ? value : "" end end