site5/rainman — Issue #1: Bug with config when using same :class_name for multiple handlers
Author: pstengel
Created: 2012-01-11 21:09:43+00:00
State: open

When using two handlers that utilize the same class, the config options are only parsed for the second one. Consider the following code:

```ruby
require 'rainman'

module MyDriver
extend Rainman::Driver

class MyDriver::MyHandlerClass
def initialize()
puts self.class.config[:example]
end

def dummy();;end
end

register_handler(
:my_first_handler,
:class_name => "MyDriver::MyHandlerClass"
) do
config[:example] = "It is working properly!"
end

register_handler(
:my_second_handler,
:class_name => "MyDriver::MyHandlerClass"
) do
config[:example] = "It is not working properly :("
end

define_action :dummy do;;end
end

MyDriver.set_current_handler(:my_first_handler)
MyDriver.dummy
```

The output:

pstengel@core ~/tmp $ ruby rainman_test.rb
It is not working properly :(