lib/fnordmetric/app.rb in fnordmetric-0.5.5 vs lib/fnordmetric/app.rb in fnordmetric-0.5.6

- old
+ new

@@ -14,11 +14,11 @@ set :views, ::File.expand_path('../../../haml', __FILE__) set :public, ::File.expand_path('../../../pub', __FILE__) def initialize(namespaces, opts) @namespaces = {} - @redis = Redis.new + @redis = Redis.connect(:url => opts[:redis_url]) @opts = opts namespaces.each do |key, block| @namespaces[key] = FnordMetric::Namespace.new(key, opts.clone) @namespaces[key].instance_eval(&block) @namespaces[key].ready!(@redis.clone) @@ -30,9 +30,13 @@ include Rack::Utils alias_method :h, :escape_html def path_prefix request.env["SCRIPT_NAME"] + end + + def namespaces + @namespaces end def current_namespace @namespaces[@namespaces.keys.detect{ |k| k.to_s == params[:namespace]