0

I want to see test and test2

configatron.providers.test.remote_dir = '/incoming/test/current'
configatron.providers.test.local_dir = 'data/test'
configatron.providers.test2.remote_dir = '/incoming/test2/current'
configatron.providers.test2.local_dir = 'data/test2'


configatron.providers.foreach do |p| 
    p.name() #<--- how to display test/test2
end

Tried reading the manual? did I miss this somewhere? Google was no help.

Thanks.

dlite922
  • 1,924
  • 3
  • 24
  • 60

1 Answers1

0

i guess this is what you are looking for:

configatron.providers.configatron_keys.map { |key| configatron.providers.send(key).local_dir }
phoet
  • 18,688
  • 4
  • 46
  • 74
  • kind of. If I'm looping on providers (to do something with them), why can't I just simply get the name of the current provider i'm on without changing my whole natural foreach loop to what you have above? – dlite922 Jul 12 '12 at 17:25
  • Here's a use case. Logging! What if a I want to log the name of that provider. i.e. loop through the providers log.info("Initializing provider #{x}..."), then do something with provider configs. – dlite922 Jul 12 '12 at 18:21
  • i mean that configatron is not a great fit here. as you can see it is possible to iterate over your providers. so what more do you need? – phoet Jul 12 '12 at 19:42
  • The providers are "configurable" (i.e. in a config file changed by admin). They change, hence the foreach loop. It would be nice to print the name of the provider I'm currently processing in a log or to screen. Guess that's too much to ask of configatron. – dlite922 Jul 12 '12 at 20:05