C
Chris Dempsey
[Note: parts of this message were removed to make it a legal post.]
I'm trying to read in a YAML string stored in a configuration file and have
Ruby perform String interpolation on it.
For example,
=== YAML file ===
remote_machine: "${server}:${port}"
=== RUBY ===
def load_settings
@options = {}
imports = YAML.load_file('server-info.yaml')
if imports
imports.each_pair do |key, value|
if not key.is_a? Symbol
imports[key.to_sym] = value
imports.delete(key)
end
end
@options = imports.merge(@options)
end
end
server = '192.168.0.1'
port = '8080'
print @options[:remote_machine] # => 192.168.0.1:8080
Instead what I'm getting is the printing of ${server}:${port}.
I'm trying to read in a YAML string stored in a configuration file and have
Ruby perform String interpolation on it.
For example,
=== YAML file ===
remote_machine: "${server}:${port}"
=== RUBY ===
def load_settings
@options = {}
imports = YAML.load_file('server-info.yaml')
if imports
imports.each_pair do |key, value|
if not key.is_a? Symbol
imports[key.to_sym] = value
imports.delete(key)
end
end
@options = imports.merge(@options)
end
end
server = '192.168.0.1'
port = '8080'
print @options[:remote_machine] # => 192.168.0.1:8080
Instead what I'm getting is the printing of ${server}:${port}.