Class: Lumberjack::Device::Couchdb

Inherits:
Lumberjack::Device show all
Defined in:
lib/lumberjack/couchdb.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, options = {}) ⇒ Couchdb

Returns a new instance of Couchdb.



10
11
12
13
# File 'lib/lumberjack/couchdb.rb', line 10

def initialize(url,options = {})
  server = CouchRest.new(url)
  @db = server.database!(options[:db]) 	
end

Instance Attribute Details

#dbObject (readonly)

Returns the value of attribute db.



8
9
10
# File 'lib/lumberjack/couchdb.rb', line 8

def db
  @db
end

Instance Method Details

#write(entry) ⇒ Object



15
16
17
18
# File 'lib/lumberjack/couchdb.rb', line 15

def write(entry)
 hash = entry.instance_variables.mash {|v| [v[1..-1],entry.instance_variable_get(v)]}
      @db.save_doc(hash)  		
end