lib/memcacheauth.rb in memcache-auth-0.2.2 vs lib/memcacheauth.rb in memcache-auth-0.2.3

- old
+ new

@@ -7,8 +7,18 @@ end super(servers, opts) end end -class MemcacheAuth::Rails < MemcacheAuth - MemCacheError = Memcached::Error +class MemcacheAuth::Rails < Memcached::Rails + def initialize(opts = {}) + opts = args.last.is_a?(Hash) ? args.pop : {} + servers = Array( + args.any? ? args.unshift : opts.delete(:servers) + ).flatten.compact + + if !servers && ENV['MEMCACHE_SERVERS'] + servers = ENV['MEMCACHE_SERVERS'].split(',') + end + super(servers, opts) + end end