I''m loading application-wide variables from a yaml file, and one of
them is a symbol
development:
LDAP_HOST: ''ldap.x.edu.au''
LDAP_PORT: ''636''
LDAP_ENC: '':simple_tls''
...
That works fine, and I use the vars like this:
ldap_con = Net::LDAP.new(
:host => APP_CONFIG[''LDAP_HOST''],
:port => APP_CONFIG[''LDAP_PORT''],
:encryption => {:method =>
eval(APP_CONFIG[''LDAP_ENC''].to_s)}
)
Converting the third variable LDAP_ENC to a string, then evaluating it
looks ugly. Is there a better way to draw on symbols from a yaml
file?
Or how about a syntax to dynamically specify the name of the symbol if
what''s stored in the yaml file is just
LDAP_ENC: ''simple_tls''
thanks!
--
George Bray, The Australian National University, Canberra, Australia.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---