From c0fc5ac5b5d955b1789a58153952e43bb7052b07 Mon Sep 17 00:00:00 2001 From: Azul Date: Tue, 11 Sep 2012 13:02:27 +0200 Subject: configuring couchDB the CouchRest way and using that for tracking --- lib/config.rb | 18 ------------------ lib/couch_stream.rb | 6 +++--- 2 files changed, 3 insertions(+), 21 deletions(-) delete mode 100644 lib/config.rb (limited to 'lib') diff --git a/lib/config.rb b/lib/config.rb deleted file mode 100644 index dded140..0000000 --- a/lib/config.rb +++ /dev/null @@ -1,18 +0,0 @@ -require 'yaml' - -module LeapCA - class Config - def initialize(filename) - file = File.new(filename, 'r') - @hash = YAML::load(file) - end - - def server - @hash['server'] - end - - def database - @hash['database'] - end - end -end diff --git a/lib/couch_stream.rb b/lib/couch_stream.rb index 081688a..ed56db2 100644 --- a/lib/couch_stream.rb +++ b/lib/couch_stream.rb @@ -1,6 +1,6 @@ class CouchStream - def initialize(config) - @config = config + def initialize(database_url) + @database_url = database_url end def get(path, options) @@ -14,7 +14,7 @@ class CouchStream protected def url_for(path, options = {}) - url = [@config.server, @config.database, path].join('/') + url = [@database_url, path].join('/') url += '?' if options.any? url += options.map {|k,v| "#{k}=#{v}"}.join('&') end -- cgit v1.2.3