Browse files

minor Chat.setup style tweaks

  • Loading branch information...
1 parent a5e9976 commit 6652ed0106630776113a9675ec62ec1b634adea8 @sr sr committed Jan 3, 2012
Showing with 5 additions and 3 deletions.
  1. +5 −3 lib/janky/chat.rb
View
8 lib/janky/chat.rb
@@ -2,20 +2,22 @@ module Janky
module Chat
Room = Struct.new(:id, :name)
- # Setup service used to notify chat rooms of build status.
+ # Setup the adapter used to notify chat rooms of build status.
#
# name - Service name as a string.
# settings - Service-specific setting hash.
# default - Name of the default chat room as a String.
#
# Returns nothing.
def self.setup(name, settings, default)
- if !adapters[name]
+ klass = adapters[name]
+
+ if !klass
raise Error, "Unknown chat service: #{name.inspect}. Available " \
"services are #{adapters.keys.join(", ")}"
end
- @adapter = adapters[name].new(settings)
+ @adapter = klass.new(settings)
@default_room_name = default
end

0 comments on commit 6652ed0

Please sign in to comment.