If I already have a hash, can I make it so that
h[:foo]
h['foo']
are the same? (is this called indifferent access?)
The details: I loaded this hash using the following in initializers
but probably shouldn't make a difference:
SETTINGS = YAML.load_file("#{RAILS_ROOT}/config/settings.yml")
Use HashWithIndifferentAccess instead of normal Hash.
For completeness, write:
You can just use
with_indifferent_access
.If you have a hash already, you can do:
You can also write the YAML file that way:
after that: