lib/extface.rb in extface-0.0.2 vs lib/extface.rb in extface-0.0.3
- old
+ new
@@ -7,28 +7,34 @@
mattr_reader :mappings
@@mappings = ActiveSupport::OrderedHash.new
class << self
+ def setup
+ yield self
+ end
+
def add_mapping(resource, options)
mapping = Extface::Mapping.new(resource, options)
@@mappings[mapping.name] = mapping
end
def redis_block
- r = Redis.new
+ r = redis_instance
begin
yield r
ensure
r.quit
end
end
private
- def parse_redis_url
+ def redis_instance
if @@redis_connection_string
uri = URI.parse(@@redis_connection_string)
- return {:host => uri.host, :port => uri.port, :password => uri.password}
+ Redis.new(host: uri.host, port: uri.port, password: uri.password)
+ else
+ Redis.new
end
end
end
end