diff options
author | Azul <azul@riseup.net> | 2012-09-11 13:02:27 +0200 |
---|---|---|
committer | Azul <azul@riseup.net> | 2012-09-11 13:02:27 +0200 |
commit | c0fc5ac5b5d955b1789a58153952e43bb7052b07 (patch) | |
tree | fd9b3e98cd9c75c09b33c4ee8e8af3996309abb4 /lib | |
parent | c331d70638c35d807128e39a9958cab5ba4eeb25 (diff) |
configuring couchDB the CouchRest way and using that for tracking
Diffstat (limited to 'lib')
-rw-r--r-- | lib/config.rb | 18 | ||||
-rw-r--r-- | lib/couch_stream.rb | 6 |
2 files changed, 3 insertions, 21 deletions
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 |