allow hipchat rooms_notified to accept a comma delimited string or array #392

wants to merge 3 commits into


None yet
1 participant

jlambert121 commented Jan 15, 2013

Allow the hipchat configuration to accept both a comma delimited string (new) or array (existing).

This allows more intuitive configuration for a single room such as:
hipchat.rooms_notified = 'room1'

and an easier configuration from puppet by specifying:
hipchat.rooms_notified = 'room1, room2'


ghost commented Jan 15, 2013

The code already handles this being set as a String (for a single room).
In #send_message, you could change [rooms_notified].flatten
to Array(rooms_notified).map {|r| r.split(',').map(&:strip) }.flatten
to handle a comma-delimited string.
But, the wiki states this is a required setting and should be an Array.
Couldn't you just use:

hipchat.rooms_notified = %w{ room1 room2 room3 }

jlambert121 commented Jan 15, 2013

I did comma delimited since rooms can have spaces. I originally had split(/,|\s+/) but realized that could incorrectly split rooms. Your solution is much cleaner - I'll update the PR with that.


ghost commented Jan 16, 2013

Done: 2b4659c

ghost closed this Jan 16, 2013

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment