David A. Black wrote:
> Hi --
> 
> On Fri, 18 Sep 2009, Dylan Lukes wrote:
> 
>>>>
>> I'm not round tripping. I took most of your advice in your rewrite, such
>> as using name and so on.
>>
>> I still need to pass the configuration as a parameter to their
>> initialization though. The only problem is the inherited initialize from
>> the module Plugin does not seem to be properly getting the config
>> parameter.
> 
> In your previous message, you had:
> 
>      PLUGINS.each {|plugin| plugin = plugin.new(self, CONFIG[plugin])}
> and
> 
>    CONFIG = {
>      "BackupPlugin" => {
>        "interval" => (30 * 60),
>        "directory" => "backups"
>      }
>    }
> 
> The PLUGINS array contains class objects; the CONFIG hash has keys
> that are strings. If I do this:
> 
>    hash = { SomeClass => "some stuff" }
> 
> and then I do:
> 
>    hash["SomeClass"]
> 
> I'll get nil, because the hash key is a class object, not a string.
> 
> 
> David


Ah ok, wonderful. Thank you very much. As a matter of syntax, I was also 
wondering how one would do the following:

Print "Config Interval: #{config["interval"]}

Since the key is a string, it raises some minor issues.
-- 
Posted via http://www.ruby-forum.com/.