aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable/lib/action_cable/server
diff options
context:
space:
mode:
authorJon Moss <me@jonathanmoss.me>2016-01-07 09:37:41 -0500
committerJon Moss <me@jonathanmoss.me>2016-01-18 18:59:00 -0500
commit439154250ccd75e9d392a1cbb6f0105ea857e6f5 (patch)
tree943fcb259a12e8f99dbaf529dfc05f8f21d44d3e /actioncable/lib/action_cable/server
parent0016e0410b11d40a1d730a1232c40f428d67abeb (diff)
downloadrails-439154250ccd75e9d392a1cbb6f0105ea857e6f5.tar.gz
rails-439154250ccd75e9d392a1cbb6f0105ea857e6f5.tar.bz2
rails-439154250ccd75e9d392a1cbb6f0105ea857e6f5.zip
Refactor storage_adapter
Diffstat (limited to 'actioncable/lib/action_cable/server')
-rw-r--r--actioncable/lib/action_cable/server/configuration.rb14
1 files changed, 3 insertions, 11 deletions
diff --git a/actioncable/lib/action_cable/server/configuration.rb b/actioncable/lib/action_cable/server/configuration.rb
index 2bed5a9ea2..2349f36198 100644
--- a/actioncable/lib/action_cable/server/configuration.rb
+++ b/actioncable/lib/action_cable/server/configuration.rb
@@ -30,20 +30,12 @@ module ActionCable
end
end
- ADAPTER = ActionCable::StorageAdapter
-
# Returns constant of storage adapter specified in config/cable.yml
# If the adapter cannot be found, this will default to the Redis adapter
def storage_adapter
- # "ActionCable::StorageAdapter::#{adapter.capitalize}"
- adapter = config_opts['adapter']
- adapter_const = "ActionCable::StorageAdapter::#{adapter.capitalize}"
-
- if Object.const_defined?(adapter_const)
- adapter_const.constantize
- else
- ADAPTER_BASE::Redis
- end
+ # Defaults to redis if no adapter is set
+ adapter = config_opts.fetch('adapter') { 'redis' }
+ "ActionCable::StorageAdapter::#{adapter.camelize}".constantize
end
end
end